Implemented Console-style game logging system to print graphics, to stdout and gamelog.txt; Added structure to keep values for descent.cfg; Added aspect and Texture Filtering to descent.cfg; Removed mono code - printing important stuff over console; Removed some obsolete or very common defines; Code cleanup and small fixes

This commit is contained in:
zicodxx 2008-04-06 20:23:28 +00:00
parent 2b94bf476a
commit 44bbb66101
190 changed files with 764 additions and 7668 deletions

View File

@ -28,7 +28,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "gr.h"
#include "grdef.h"
#include "rle.h"
#include "mono.h"
#include "byteswap.h" // because of rle code that has short for row offsets
#include "error.h"
@ -680,8 +679,6 @@ void gr_bm_ubitblt0x_rle(int w, int h, int dx, int dy, int sx, int sy, grs_bitma
register int y1;
unsigned char * sbits;
//mprintf( 0, "SVGA RLE!\n" );
data_offset = 1;
if (src->bm_flags & BM_FLAG_RLE_BIG)
data_offset = 2;
@ -706,8 +703,6 @@ void gr_bm_ubitblt0xm_rle(int w, int h, int dx, int dy, int sx, int sy, grs_bitm
register int y1;
unsigned char * sbits;
//mprintf( 0, "SVGA RLE!\n" );
data_offset = 1;
if (src->bm_flags & BM_FLAG_RLE_BIG)
data_offset = 2;

View File

@ -36,11 +36,11 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "grdef.h"
#include "error.h"
#include "cfile.h"
#include "mono.h"
#include "byteswap.h"
#include "bitmap.h"
#include "makesig.h"
#include "gamefont.h"
#include "console.h"
#ifdef OGL
#include "ogl_init.h"
#endif
@ -147,13 +147,13 @@ int gr_message_color_level=1;
text_ptr++; \
if (*text_ptr){ \
if (gr_message_color_level >= *(text_ptr-1)) \
grd_curcanv->cv_font_fg_color = *text_ptr; \
grd_curcanv->cv_font_fg_color = (unsigned char)*text_ptr; \
text_ptr++; \
} \
} \
else if ((*text_ptr >= 0x04) && (*text_ptr <= 0x06)){ \
if (gr_message_color_level >= *text_ptr - 3) \
grd_curcanv->cv_font_fg_color=orig_color; \
grd_curcanv->cv_font_fg_color=(unsigned char)orig_color; \
text_ptr++; \
}
@ -198,7 +198,7 @@ int gr_internal_string0(int x, int y, char *s )
}
if (*text_ptr == CC_COLOR) {
grd_curcanv->cv_font_fg_color = *(text_ptr+1);
grd_curcanv->cv_font_fg_color = (unsigned char)*(text_ptr+1);
text_ptr += 2;
continue;
}
@ -314,7 +314,7 @@ int gr_internal_string0m(int x, int y, char *s )
}
if (*text_ptr == CC_COLOR) {
grd_curcanv->cv_font_fg_color = *(text_ptr+1);
grd_curcanv->cv_font_fg_color = (unsigned char)*(text_ptr+1);
text_ptr += 2;
continue;
}
@ -435,7 +435,7 @@ int gr_internal_color_string(int x, int y, char *s )
if (*text_ptr == '\n' )
{
next_row = &text_ptr[1];
yy += grd_curcanv->cv_font->ft_h;
yy += grd_curcanv->cv_font->ft_h+FSPACY(1);
break;
}
@ -498,7 +498,6 @@ void ogl_font_choose_size(grs_font * font,int gap,int *rw,int *rh){
if (tries)
w=pow2ize(w+1);
if(tries>3){
mprintf((0,"failed to fit (%ix%i, %ic)\n",w,h,nc));
break;
}
nc=0;
@ -526,7 +525,6 @@ void ogl_font_choose_size(grs_font * font,int gap,int *rw,int *rh){
}while(nc!=nchars);
if (nc!=nchars)
continue;
mprintf((0,"fit: %ix%i %i tries\n",w,h,tries));
if (w*h==smallest){//this gives squarer sizes priority (ie, 128x128 would be better than 512*32)
if (w>=h){
@ -550,8 +548,6 @@ void ogl_font_choose_size(grs_font * font,int gap,int *rw,int *rh){
}
if (smallr<=0)
Error("couldn't fit font?\n");
mprintf((0,"using %ix%i\n",*rw,*rh));
}
void ogl_init_font(grs_font * font){
@ -574,21 +570,15 @@ void ogl_init_font(grs_font * font){
ogl_init_texture(font->ft_parent_bitmap.gltexture = ogl_get_free_texture(), tw, th, oglflags); // have to init the gltexture here so the subbitmaps will find it.
font->ft_bitmaps=(grs_bitmap*)d_malloc( nchars * sizeof(grs_bitmap));
mprintf((0,"ogl_init_font %s, %s, nchars=%i, (%ix%i tex)\n",(font->ft_flags & FT_PROPORTIONAL)?"proportional":"fixedwidth",(font->ft_flags & FT_COLOR)?"color":"mono",nchars,tw,th));
// s[1]=0;
h=font->ft_h;
// sleep(5);
for(i=0;i<nchars;i++){
// s[0]=font->ft_minchar+i;
// gr_get_string_size(s,&w,&h,&aw);
if (font->ft_flags & FT_PROPORTIONAL)
w=font->ft_widths[i];
else
w=font->ft_w;
// mprintf((0,"char %i(%ix%i): ",i,w,h));
if (w<1 || w>256){
mprintf((0,"grr\n"));continue;
continue;
}
if (curx+w+gap>tw){
cury+=h+gap;
@ -669,7 +659,7 @@ int ogl_internal_string(int x, int y, char *s )
if (*text_ptr == '\n' )
{
next_row = &text_ptr[1];
yy += FONTSCALE_Y(grd_curcanv->cv_font->ft_h);
yy += FONTSCALE_Y(grd_curcanv->cv_font->ft_h)+FSPACY(1);
break;
}
@ -743,7 +733,6 @@ int gr_string(int x, int y, char *s )
if ( clipped & 2 ) {
// Completely clipped...
mprintf( (1, "Text '%s' at (%d,%d) is off screen!\n", s, x, y ));
return 0;
}
@ -804,7 +793,7 @@ void gr_get_string_size(char *s, int *string_width, int *string_height, int *ave
while (*s == '\n')
{
s++;
*string_height += FONTSCALE_Y(grd_curcanv->cv_font->ft_h);
*string_height += FONTSCALE_Y(grd_curcanv->cv_font->ft_h)+FSPACY(1);
*string_width = 0;
}

View File

@ -1,4 +1,3 @@
/* $Id: ibitblt.c,v 1.1.1.1 2006/03/17 19:52:02 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -30,10 +29,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include <conf.h>
#endif
#ifdef RCS
static char rcsid[] = "$Id: ibitblt.c,v 1.1.1.1 2006/03/17 19:52:02 zicodxx Exp $";
#endif
#ifdef __MSDOS__ //ndef MACINTOSH
#include <conio.h>
@ -365,8 +360,6 @@ int gr_ibitblt_find_code_size_sub( grs_bitmap * mask_bmp, int sx, int sy, int sw
}
Code_counter++; // for return
//printf( "Code will be %d bytes\n", Code_counter );
Code_counter += 16; // for safety was 16
return Code_counter;
@ -482,8 +475,6 @@ ubyte *gr_ibitblt_create_mask_sub( grs_bitmap * mask_bmp, int sx, int sy, int sw
if ( Code_pointer >= &code[code_size-1] )
Error( "ibitblt overwrote allocated code block\n" );
//printf( "Code is %d bytes\n", Code_pointer - code );
return code;
}

View File

@ -31,7 +31,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "grdef.h"
#include "cfile.h"
#include "error.h"
#include "mono.h"
#include "fix.h"
#include "palette.h"

View File

@ -61,9 +61,6 @@ typedef struct {
#define PCXHEADER_SIZE 128
#ifdef FAST_FILE_IO
#define PCXHeader_read_n(ph, n, fp) cfread(ph, sizeof(PCXHeader), n, fp)
#else
/*
* reads n PCXHeader structs from a CFILE
*/
@ -90,7 +87,6 @@ int PCXHeader_read_n(PCXHeader *ph, int n, CFILE *fp)
}
return i;
}
#endif
int pcx_get_dimensions( char *filename, int *width, int *height)
{
@ -112,49 +108,6 @@ int pcx_get_dimensions( char *filename, int *width, int *height)
return PCX_ERROR_NONE;
}
#ifdef MACINTOSH
int pcx_read_bitmap_palette( char *filename, ubyte *palette)
{
PCXHeader header;
CFILE * PCXfile;
ubyte data;
int i;
PCXfile = cfopen( filename , "rb" );
if ( !PCXfile )
return PCX_ERROR_OPENING;
// read 128 char PCX header
if (PCXHeader_read_n( &header, 1, PCXfile )!=1) {
cfclose( PCXfile );
return PCX_ERROR_NO_HEADER;
}
// Is it a 256 color PCX file?
if ((header.Manufacturer != 10)||(header.Encoding != 1)||(header.Nplanes != 1)||(header.BitsPerPixel != 8)||(header.Version != 5)) {
cfclose( PCXfile );
return PCX_ERROR_WRONG_VERSION;
}
// Read the extended palette at the end of PCX file
// Read in a character which should be 12 to be extended palette file
if (palette != NULL) {
cfseek( PCXfile, -768, SEEK_END );
cfread( palette, 3, 256, PCXfile );
cfseek( PCXfile, PCXHEADER_SIZE, SEEK_SET );
for (i=0; i<768; i++ )
palette[i] >>= 2;
#ifdef MACINTOSH
for (i = 0; i < 3; i++) {
data = palette[i];
palette[i] = palette[765+i];
palette[765+i] = data;
}
#endif
}
}
#endif
int pcx_read_bitmap( char * filename, grs_bitmap * bmp,int bitmap_type ,ubyte * palette )
{
PCXHeader header;

View File

@ -1,4 +1,3 @@
/* $Id: rle.c,v 1.1.1.1 2006/03/17 19:51:59 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -24,19 +23,12 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include <conf.h>
#endif
#ifdef RCS
static char rcsid[] = "$Id: rle.c,v 1.1.1.1 2006/03/17 19:51:59 zicodxx Exp $";
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "pstypes.h"
#include "u_mem.h"
#include "mono.h"
#include "gr.h"
#include "grdef.h"
#include "error.h"
@ -489,7 +481,6 @@ int gr_bitmap_rle_compress( grs_bitmap * bmp )
else
rle_data[y+4] = d;
}
//mprintf( 0, "Bitmap of size %dx%d, (%d bytes) went down to %d bytes\n", bmp->bm_w, bmp->bm_h, bmp->bm_h*bmp->bm_w, doffset );
memcpy( rle_data, &doffset, 4 );
memcpy( bmp->bm_data, rle_data, doffset );
d_free(rle_data);
@ -597,9 +588,6 @@ grs_bitmap * rle_expand_texture( grs_bitmap * bmp )
}
}
// if (((rle_counter % 100)==1) && (rle_hits+rle_misses > 0))
// mprintf(( 0, "RLE-CACHE %d%%, H:%d, M:%d\n", (rle_misses*100)/(rle_hits+rle_misses), rle_hits, rle_misses ));
lowest_count = rle_cache[rle_next].last_used;
least_recently_used = rle_next;
rle_next++;

View File

@ -1,4 +1,3 @@
/* $Id: scale.c,v 1.1.1.1 2006/03/17 19:51:59 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -21,16 +20,10 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include <conf.h>
#endif
#ifdef RCS
static char rcsid[] = "$Id: scale.c,v 1.1.1.1 2006/03/17 19:51:59 zicodxx Exp $";
#endif
#include <math.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include "mono.h"
#include "fix.h"
#include "gr.h"
#include "error.h"
@ -143,8 +136,6 @@ void scale_bitmap(grs_bitmap *bp, grs_point *vertbuf ,int orientation)
Assert( u1<i2f(bp->bm_w) );
Assert( v1<i2f(bp->bm_h) );
//mprintf( 0, "(%.2f,%.2f) to (%.2f,%.2f) using (%.2f,%.2f) to (%.2f,%.2f)\n", f2fl(clipped_x0), f2fl(clipped_y0), f2fl(clipped_x1), f2fl(clipped_y1), f2fl(clipped_u0), f2fl(clipped_v0), f2fl(clipped_u1), f2fl(clipped_v1) );
dtemp = f2i(clipped_u1)-f2i(clipped_u0);
if ( bp->bm_flags & BM_FLAG_RLE ) {

View File

@ -1,4 +1,3 @@
/* $Id: scalec.c,v 1.1.1.1 2006/03/17 19:52:00 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -491,18 +490,6 @@ void scale_bitmap(grs_bitmap *bp, grs_point *vertbuf, int orientation )
if (dx1<=dx0) return;
if (dy1<=dy0) return;
// Assert( dx0>=0 );
// Assert( dy0>=0 );
// Assert( dx1<dbp->bm_w );
// Assert( dy1<dbp->bm_h );
// Assert( f2i(u0)<=f2i(u1) );
// Assert( f2i(v0)<=f2i(v1) );
// Assert( f2i(u0)>=0 );
// Assert( f2i(v0)>=0 );
// Assert( u1<i2f(bp->bm_w) );
// Assert( v1<i2f(bp->bm_h) );
//mprintf( 0, "(%.2f,%.2f) to (%.2f,%.2f) using (%.2f,%.2f) to (%.2f,%.2f)\n", f2fl(clipped_x0), f2fl(clipped_y0), f2fl(clipped_x1), f2fl(clipped_y1), f2fl(clipped_u0), f2fl(clipped_v0), f2fl(clipped_u1), f2fl(clipped_v1) );
dtemp = f2i(clipped_u1)-f2i(clipped_u0);
if ( bp->bm_flags & BM_FLAG_RLE ) {

View File

@ -1,5 +1,9 @@
D2X-Rebirth Changelog
20080406
--------
d2x.ini, SConstruct, main/config.c, main/config.h, main/console.c, main/console.h + various: Implemented Console-style game logging system to print graphics, to stdout and gamelog.txt; Added structure to keep values for descent.cfg; Added aspect and Texture Filtering to descent.cfg; Removed mono code - printing important stuff over console; Removed some obsolete or very common defines; Code cleanup and small fixes
20080227
--------
d2x-rebirth.xcodeproj, main/bmread.c, main/piggy.c: allow external sound files to be put in 'Sounds' folder, update Xcode project

View File

@ -25,7 +25,6 @@ profiler = int(ARGUMENTS.get('profiler', 0))
sdl_only = int(ARGUMENTS.get('sdl_only', 0))
asm = int(ARGUMENTS.get('asm', 0))
editor = int(ARGUMENTS.get('editor', 0))
console = int(ARGUMENTS.get('console',0))
sdlmixer = int(ARGUMENTS.get('sdlmixer', 0))
arm = int(ARGUMENTS.get('arm', 0))
ipv6 = int(ARGUMENTS.get('ipv6', 0))
@ -89,7 +88,6 @@ common_sources = [
'main/ai.c',
'main/ai2.c',
'main/aipath.c',
'main/digiobj.c',
'main/automap.c',
'main/bm.c',
'main/cntrlcen.c',
@ -99,6 +97,7 @@ common_sources = [
'main/controls.c',
'main/credits.c',
'main/crypt.c',
'main/digiobj.c',
'main/dumpmine.c',
'main/effects.c',
'main/endlevel.c',
@ -237,7 +236,6 @@ editor_sources = [
arch_linux_sources = [
'arch/linux/netdrv_ipx.c',
'arch/linux/netdrv_kali.c',
'arch/linux/mono.c',
'arch/linux/ukali.c'
]
@ -256,7 +254,6 @@ if (sdlmixer == 1):
arch_win32_sources = [
'arch/win32/hmpfile.c',
'arch/win32/netdrv_ipx.c',
'arch/win32/mono.c'
]
# for Mac OS X
@ -303,11 +300,11 @@ noasm_sources = [
env = Environment(ENV = os.environ)
env.ParseConfig('sdl-config --cflags')
env.ParseConfig('sdl-config --libs')
env.Append(CPPFLAGS = ['-Wall'])
env.Append(CPPFLAGS = ['-Wall', '-funsigned-char'])
env.Append(CPPDEFINES = [('D2XMAJOR', '\\"' + str(D2XMAJOR) + '\\"'), ('D2XMINOR', '\\"' + str(D2XMINOR) + '\\"')])
#env.Append(CPPDEFINES = [('VERSION', '\\"' + str(VERSION) + '\\"')])
#env.Append(CPPDEFINES = [('USE_SDLMIXER', sdlmixer)])
env.Append(CPPDEFINES = ['NMONO', 'PIGGY_USE_PAGING', 'NETWORK', 'HAVE_NETIPX_IPX_H', 'NEWDEMO', '_REENTRANT'])
env.Append(CPPDEFINES = ['NETWORK', 'HAVE_NETIPX_IPX_H', '_REENTRANT'])
env.Append(CPPPATH = ['include', 'main', 'arch/include'])
generic_libs = ['SDL', 'physfs']
sdlmixerlib = ['SDL_mixer']
@ -339,7 +336,7 @@ if sys.platform == 'win32':
sharepath = ''
env.Append(CPPDEFINES = ['_WIN32', 'HAVE_STRUCT_TIMEVAL', 'NATIVE_IPX'])
env.Append(CPPPATH = ['arch/win32/include'])
ogldefines = ['SDL_GL_VIDEO', 'OGL']
ogldefines = ['OGL']
common_sources += arch_win32_sources
ogllibs = ''
winlibs = ['glu32', 'wsock32', 'winmm', 'mingw32', 'SDLmain']
@ -352,7 +349,7 @@ elif sys.platform == 'darwin':
env.Append(CPPDEFINES = ['HAVE_STRUCT_TIMESPEC', 'HAVE_STRUCT_TIMEVAL', '__unix__'])
asm = 0
env.Append(CPPPATH = ['arch/linux/include'])
ogldefines = ['SDL_GL_VIDEO', 'OGL']
ogldefines = ['OGL']
common_sources += arch_macosx_sources
ogllibs = ''
libs = ''
@ -377,7 +374,7 @@ else:
sharepath += '/'
env.Append(CPPDEFINES = ['__LINUX__', 'NATIVE_IPX', 'KALINIX', 'HAVE_STRUCT_TIMESPEC', 'HAVE_STRUCT_TIMEVAL'])
env.Append(CPPPATH = ['arch/linux/include'])
ogldefines = ['SDL_GL_VIDEO', 'OGL']
ogldefines = ['OGL']
common_sources += arch_linux_sources
ogllibs = ['GL', 'GLU']
libs = generic_libs
@ -393,7 +390,6 @@ if (arm == 1):
if (sdl_only == 1):
print "building with SDL"
target = 'd2x-rebirth-sdl'
env.Append(CPPDEFINES = ['SDL_VIDEO'])
common_sources += arch_sdl_sources
else:
print "building with OpenGL"
@ -423,7 +419,6 @@ if (profiler == 1):
# assembler code?
if (asm == 1) and (sdl_only == 1):
print "including: ASSEMBLER"
env.Append(CPPDEFINES = ['ASM_VECMAT'])
Object(['texmap/tmappent.S', 'texmap/tmapppro.S'], AS='gcc', ASFLAGS='-D' + str(osdef) + ' -c ')
env.Replace(AS = 'nasm')
env.Append(ASCOM = ' -f ' + str(osasmdef) + ' -d' + str(osdef) + ' -Itexmap/ ')
@ -438,11 +433,6 @@ if (editor == 1):
env.Append(CPPPATH = ['include/editor'])
common_sources += editor_sources
#console?
if (console == 1):
env.Append(CPPDEFINES = ['CONSOLE'])
common_sources += ['main/cmd.c', 'console/CON_console.c']
# IPv6 compability?
if (ipv6 == 1):
env.Append(CPPDEFINES = ['IPv6'])
@ -480,7 +470,6 @@ Help(PROGRAM_NAME + ', SConstruct file help:' +
'asm=1' use ASSEMBLER code (only with sdl_only=1, requires NASM and x86)
'debug=1' build DEBUG binary which includes asserts, debugging output, cheats and more output
'profiler=1' do profiler build
'console=1' build with console support !EXPERIMENTAL!
'editor=1' build editor !EXPERIMENTAL!
'arm=1' compile for ARM architecture
'ipv6=1' enables IPv6 copability (not compatible to non-IPv6 build)

View File

@ -17,9 +17,6 @@
/* Define if you want to build the editor */
/* #undef EDITOR */
/* Define for faster i/o on little-endian cpus */
/* #undef FAST_FILE_IO */
/* Define if you want a GGI build */
/* #undef GGI */
@ -107,9 +104,6 @@
/* General defines */
#define VERSION_NAME PACKAGE_STRING
#define NMONO 1
#define PIGGY_USE_PAGING 1
#define NEWDEMO 1
#if defined(__APPLE__) && defined(__MACH__)
#define __unix__
@ -166,21 +160,11 @@
# define SVGALIB_VIDEO 1
# else
# define SDL_INPUT 1
# ifdef OGL
# define SDL_GL_VIDEO 1
# else
# define SDL_VIDEO 1
# endif
# endif
# endif
#endif
#ifdef macintosh
# define SDL_INPUT 1
# ifdef OGL
# define SDL_GL_VIDEO 1
# else
# define SDL_VIDEO 1
# endif
#endif

View File

@ -10,8 +10,6 @@ void digi_audio_stop_all_channels();
int digi_audio_start_sound(short, fix, int, int, int, int, int );
int digi_audio_find_channel(int );
int digi_audio_is_sound_playing(int );
void digi_audio_set_max_channels(int );
int digi_audio_get_max_channels();
int digi_audio_is_channel_playing(int );
void digi_audio_set_channel_volume(int, int );
void digi_audio_set_channel_pan(int, int );

View File

@ -1,4 +1,3 @@
/* $Id: alsadigi.c,v 1.1.1.1 2006/03/17 19:53:46 zicodxx Exp $ */
/*
*
* ALSA digital audio support
@ -12,7 +11,6 @@
#include <pthread.h>
#include "error.h"
#include "mono.h"
#include "fix.h"
#include "vecmat.h"
#include "gr.h" // needed for piggy.h
@ -212,7 +210,7 @@ void *mixer_thread(void *data)
err = snd_pcm_prepare(snd_devhandle);
if (err < 0)
{
fprintf(stderr, "Can't recover from underrun: %s\n", snd_strerror(err));
con_printf(CON_CRITICAL, "Can't recover from underrun: %s\n", snd_strerror(err));
}
}
else if (err == -EAGAIN)
@ -223,7 +221,7 @@ void *mixer_thread(void *data)
{
// Each frame has size 2 bytes - hence we expect SOUND_BUFFER_SIZE/2
// frames to be written.
fprintf(stderr, "Unknown err %d: %s\n", err, snd_strerror(err));
con_printf(CON_CRITICAL, "Unknown err %d: %s\n", err, snd_strerror(err));
}
}
return 0;
@ -246,7 +244,7 @@ int digi_init()
/* Open the ALSA sound device */
if ((err = snd_pcm_open(&snd_devhandle, device, SND_PCM_STREAM_PLAYBACK)) < 0)
{
fprintf(stderr, "open failed: %s\n", snd_strerror( err ));
con_printf(CON_CRITICAL, "open failed: %s\n", snd_strerror( err ));
return -1;
}
@ -254,32 +252,32 @@ int digi_init()
err = snd_pcm_hw_params_any(snd_devhandle, params);
if (err < 0)
{
printf("ALSA: Error %s\n", snd_strerror(err));
con_printf(CON_CRITICAL,"ALSA: Error %s\n", snd_strerror(err));
return -1;
}
err = snd_pcm_hw_params_set_access(snd_devhandle, params, SND_PCM_ACCESS_RW_INTERLEAVED);
if (err < 0)
{
printf("ALSA: Error %s\n", snd_strerror(err));
con_printf(CON_CRITICAL,"ALSA: Error %s\n", snd_strerror(err));
return -1;
}
err = snd_pcm_hw_params_set_format(snd_devhandle, params, SND_PCM_FORMAT_U8);
if (err < 0)
{
printf("ALSA: Error %s\n", snd_strerror(err));
con_printf(CON_CRITICAL,"ALSA: Error %s\n", snd_strerror(err));
return -1;
}
err = snd_pcm_hw_params_set_channels(snd_devhandle, params, 2);
if (err < 0)
{
printf("ALSA: Error %s\n", snd_strerror(err));
con_printf(CON_CRITICAL,"ALSA: Error %s\n", snd_strerror(err));
return -1;
}
tmp = 11025;
err = snd_pcm_hw_params_set_rate_near(snd_devhandle, params, &tmp, NULL);
if (err < 0)
{
printf("ALSA: Error %s\n", snd_strerror(err));
con_printf(CON_CRITICAL,"ALSA: Error %s\n", snd_strerror(err));
return -1;
}
snd_pcm_hw_params_set_periods(snd_devhandle, params, 3, 0);
@ -288,7 +286,7 @@ int digi_init()
err = snd_pcm_hw_params(snd_devhandle, params);
if (err < 0)
{
printf("ALSA: Error %s\n", snd_strerror(err));
con_printf(CON_CRITICAL,"ALSA: Error %s\n", snd_strerror(err));
return -1;
}
@ -300,7 +298,7 @@ int digi_init()
pthread_mutexattr_destroy(&mutexattr);
if (pthread_attr_init(&attr) != 0) {
fprintf(stderr, "failed to init attr\n");
con_printf(CON_CRITICAL, "failed to init attr\n");
snd_pcm_close( snd_devhandle );
return -1;
}
@ -369,7 +367,6 @@ int digi_start_sound(short soundnum, fix volume, int pan, int looping, int loop_
next_channel = 0;
if (next_channel == starting_channel)
{
mprintf((1, "OUT OF SOUND CHANNELS!!!\n"));
UNLOCK();
return -1;
}
@ -453,7 +450,6 @@ void digi_set_volume(int dvolume, int mvolume)
{
digi_set_digi_volume(dvolume);
digi_set_midi_volume(mvolume);
// mprintf(( 1, "Volume: 0x%x and 0x%x\n", digi_volume, midi_volume ));
}
int digi_is_sound_playing(int soundno)

View File

@ -95,8 +95,6 @@ void seqbuf_dump()
void my_quit()
{
// printf("goodbye\n");//#####
// exit(0);
}
int seq_init()
@ -124,7 +122,7 @@ int seq_init()
if(nrsynths < 1 && nrmidis < 1)
{
printf("No synth or midi device!\n");
con_printf(CON_URGENT,"No synth or midi device!\n");
return -1;
}
@ -560,7 +558,7 @@ int do_track_event(unsigned char *data, int *pos)
void send_ipc(char *message)
{
printf ("sendipc %s\n", message);
printf(CON_DEBUG,"sendipc %s\n", message);
if (ipc_queue_id<0)
{
ipc_queue_id=msgget ((key_t) ('l'<<24) | ('d'<<16) | ('e'<<8) | 's',
@ -602,12 +600,12 @@ int do_ipc(int qid, struct msgbuf *buf, int flags)
case 0:
break;
default:
printf ("do_ipc %s\n", buf->mtext);//##########3
con_printf(CON_DEBUG,"do_ipc %s\n", buf->mtext);//##########3
switch (buf->mtext[0])
{
case 'v':
volume = (double)(atof(buf->mtext + 1) / 128.0);
printf("vol %f->%f\n", last_volume, volume);
con_printf(CON_DEBUG,"vol %f->%f\n", last_volume, volume);
if (last_volume <= 0 && volume > 0)
{
buf->mtext[0] = 'p'; // start playing again if volume raised above 0
@ -635,7 +633,7 @@ int do_ipc(int qid, struct msgbuf *buf, int flags)
data=realloc(data,(size_t) l);
cfread(data, l, 1, fptr);
cfclose(fptr);
printf ("good. fpr=%p l=%i data=%p\n", fptr, l, data);//##########3
con_printf(CON_DEBUG,"good. fpr=%p l=%i data=%p\n", fptr, l, data);//##########3
stop = 0;
}
else
@ -671,7 +669,7 @@ void play_hmi (void * arg)
Track_info *t_info;
printf ("play_hmi\n");//#########
con_printf(CON_DEBUG,"play_hmi\n");
stop = 0;
ipc_read=0;
@ -745,7 +743,7 @@ void play_hmi (void * arg)
}
if (low_dtime < 0)
printf("Serious warning: d_time negative!!!!!!\n");
con_printf(CON_URGENT,"Serious warning: d_time negative!!!!!!\n");
csec = 0.86 * low_dtime;
@ -770,7 +768,7 @@ void play_hmi (void * arg)
if (t_info[low_chunk].status == 3)
{
printf("Error playing data in chunk %d\n",low_chunk);
con_printf(CON_URGENT,"Error playing data in chunk %d\n",low_chunk);
t_info[low_chunk].status = STOPPED;
}

View File

@ -1,4 +1,3 @@
/* $Id: ukali.h,v 1.1.1.1 2006/03/17 19:53:51 zicodxx Exp $ */
/*
*
* Header for kali support functions

View File

@ -1,20 +0,0 @@
#include <stdio.h>
#include <stdarg.h>
#define MONO_IS_STDERR
//added 05/17/99 Matt Mueller - needed for editor build
int minit(void){return -1;}
//end addition -MM
void mopen( short n, short row, short col, short width, short height, char * title ) {}
void mclose(short n) {}
void _mprintf( short n, char * format, ... )
#ifdef MONO_IS_STDERR
{
va_list args;
va_start(args, format );
vfprintf(stderr, format, args);
}
#else
{}
#endif

View File

@ -17,9 +17,7 @@
#include <unistd.h>
#include <errno.h>
#include "netdrv.h"
#include "mono.h"
#define n_printf(format, args...) mprintf((1, format, ## args))
#include "console.h"
static socket_t IPX_sock;
@ -34,7 +32,7 @@ static int IPXGetMyAddress( void )
sock=socket(AF_IPX,SOCK_DGRAM,PF_IPX);
if(sock==-1)
{
n_printf("IPX: could not open socket in GetMyAddress\n");
con_printf(CON_URGENT,"IPX: could not open socket in GetMyAddress\n");
return(-1);
}
@ -45,7 +43,7 @@ static int IPXGetMyAddress( void )
if(bind(sock,(struct sockaddr *)&ipxs,sizeof(ipxs))==-1)
{
n_printf("IPX: could bind to network 0 in GetMyAddress\n");
con_printf(CON_URGENT,"IPX: could bind to network 0 in GetMyAddress\n");
close( sock );
return(-1);
}
@ -53,7 +51,7 @@ static int IPXGetMyAddress( void )
len = sizeof(ipxs2);
if (getsockname(sock,(struct sockaddr *)&ipxs2,&len) < 0)
{
n_printf("IPX: could not get socket name in GetMyAddress\n");
con_printf(CON_URGENT,"IPX: could not get socket name in GetMyAddress\n");
close( sock );
return(-1);
}
@ -78,7 +76,7 @@ static int IPXOpenSocket(int port)
/* do a socket call, then bind to this port */
sock = socket(AF_IPX, SOCK_DGRAM, PF_IPX);
if (sock == -1) {
n_printf("IPX: could not open IPX socket.\n");
con_printf(CON_URGENT,"IPX: could not open IPX socket.\n");
return -1;
}
@ -86,7 +84,7 @@ static int IPXOpenSocket(int port)
/* Permit broadcast output */
if (setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &opt, sizeof(opt)) == -1)
{
n_printf("IPX: could not set socket option for broadcast.\n");
con_printf(CON_URGENT,"IPX: could not set socket option for broadcast.\n");
return -1;
}
@ -99,7 +97,7 @@ static int IPXOpenSocket(int port)
/* now bind to this port */
if (bind(sock, (struct sockaddr *) &ipxs, sizeof(ipxs)) == -1)
{
n_printf("IPX: could not bind socket to address\n");
con_printf(CON_URGENT,"IPX: could not bind socket to address\n");
close( sock );
return -1;
}
@ -109,14 +107,14 @@ static int IPXOpenSocket(int port)
len = sizeof(ipxs2);
if (getsockname(sock,(struct sockaddr *)&ipxs2,&len) < 0)
{
n_printf("IPX: could not get socket name in IPXOpenSocket\n");
con_printf(CON_URGENT,"IPX: could not get socket name in IPXOpenSocket\n");
close( sock );
return -1;
}
else
{
port = htons(ipxs2.sipx_port);
n_printf("IPX: opened dynamic socket %04x\n", port);
con_printf(CON_URGENT,"IPX: opened dynamic socket %04x\n", port);
}
}
@ -131,7 +129,7 @@ static int IPXOpenSocket(int port)
static void IPXCloseSocket(void)
{
/* now close the file descriptor for the socket, and free it */
n_printf("IPX: closing file descriptor on socket %x\n", IPX_sock.socket);
con_printf(CON_URGENT,"IPX: closing file descriptor on socket %x\n", IPX_sock.socket);
close(IPX_sock.fd);
}

View File

@ -4,6 +4,7 @@
#include <netinet/in.h> /* for htons & co. */
#include "netdrv.h"
#include "ukali.h"
#include "console.h"
static socket_t KALI_sock;
@ -35,12 +36,12 @@ int KALIGetMyAddress(void)
int KALIOpenSocket(int port)
{
printf("kali: OpenSocket on port(%d)\n", port);
con_printf(CON_DEBUG,"kali: OpenSocket on port(%d)\n", port);
if (!open_sockets) {
if (have_empty_address()) {
if (KALIGetMyAddress() < 0) {
printf("kali: Error communicating with KaliNix\n");
con_printf(CON_CRITICAL,"kali: Error communicating with KaliNix\n");
return -1;
}
}
@ -49,7 +50,7 @@ int KALIOpenSocket(int port)
port = dynamic_socket++;
if ((KALI_sock.fd = KaliOpenSocket(htons(port))) < 0) {
printf("kali: OpenSocket Failed on port(%d)\n", port);
con_printf(CON_CRITICAL,"kali: OpenSocket Failed on port(%d)\n", port);
KALI_sock.fd = -1;
return -1;
}
@ -61,13 +62,13 @@ int KALIOpenSocket(int port)
void KALICloseSocket(void)
{
if (!open_sockets) {
printf("kali: close w/o open\n");
con_printf(CON_CRITICAL,"kali: close w/o open\n");
return;
}
printf("kali: CloseSocket on port(%d)\n", KALI_sock.socket);
con_printf(CON_DEBUG,"kali: CloseSocket on port(%d)\n", KALI_sock.socket);
KaliCloseSocket(KALI_sock.fd);
if (--open_sockets) {
printf("kali: (closesocket) %d sockets left\n", open_sockets);
con_printf(CON_URGENT,"kali: (closesocket) %d sockets left\n", open_sockets);
return;
}
}

View File

@ -41,12 +41,13 @@
#include "inferno.h"
#include "screens.h"
#include "strutil.h"
#include "mono.h"
#include "args.h"
#include "key.h"
#include "physfsx.h"
#include "internal.h"
#include "render.h"
#include "console.h"
#include "config.h"
#if defined(__APPLE__) && defined(__MACH__)
#include <OpenGL/glu.h>
@ -63,10 +64,7 @@ int gr_check_fullscreen(void){
}
void gr_do_fullscreen(int f){
if (GameArg.OglVoodooHack)
ogl_fullscreen=1;//force fullscreen mode on voodoos.
else
ogl_fullscreen=f;
ogl_fullscreen=f;
if (gl_initialized){
ogl_do_fullscreen_internal();
}
@ -74,6 +72,8 @@ void gr_do_fullscreen(int f){
int gr_toggle_fullscreen(void){
gr_do_fullscreen(!ogl_fullscreen);
gr_remap_color_fonts();
gr_remap_mono_fonts();
if (gl_initialized && Screen_mode != SCREEN_GAME) // update viewing values for menus
{
@ -186,7 +186,7 @@ int gr_set_mode(u_int32_t mode)
grd_curscreen->sc_mode = mode;
grd_curscreen->sc_w = w;
grd_curscreen->sc_h = h;
grd_curscreen->sc_aspect = fixdiv(grd_curscreen->sc_w*GameArg.GfxAspectX,grd_curscreen->sc_h*GameArg.GfxAspectY);
grd_curscreen->sc_aspect = fixdiv(grd_curscreen->sc_w*GameCfg.AspectX,grd_curscreen->sc_h*GameCfg.AspectY);
grd_curscreen->sc_canvas.cv_bitmap.bm_x = 0;
grd_curscreen->sc_canvas.cv_bitmap.bm_y = 0;
grd_curscreen->sc_canvas.cv_bitmap.bm_w = w;
@ -204,6 +204,8 @@ int gr_set_mode(u_int32_t mode)
ogl_init_state();
gamefont_choose_game_font(w,h);
gr_remap_color_fonts();
gr_remap_mono_fonts();
return 0;
}
@ -246,8 +248,6 @@ int ogl_init_load_library(void)
retcode = OpenGL_LoadLibrary(true);
if(retcode)
{
mprintf((0,"Opengl loaded ok\n"));
if(!glEnd)
{
Error("Opengl: Functions not imported\n");
@ -273,12 +273,26 @@ int gr_init(int mode)
ogl_init_load_library();
#endif
if (!GameArg.SysWindow)
if (!GameCfg.WindowMode && !GameArg.SysWindow)
gr_toggle_fullscreen();
GL_needmipmaps=ogl_testneedmipmaps(GameArg.OglTexMinFilt);
switch (GameCfg.TexFilt)
{
case 2:
OglTexMagFilt = GL_LINEAR;
OglTexMinFilt = GL_LINEAR_MIPMAP_LINEAR;
break;
case 1:
OglTexMagFilt = GL_LINEAR;
OglTexMinFilt = GL_LINEAR_MIPMAP_NEAREST;
break;
default:
OglTexMagFilt = GL_NEAREST;
OglTexMinFilt = GL_NEAREST;
break;
}
mprintf((0,"gr_init: texmagfilt:%x texminfilt:%x needmipmaps=%i\n",GameArg.OglTexMagFilt,GameArg.OglTexMinFilt,GL_needmipmaps));
GL_needmipmaps=ogl_testneedmipmaps(OglTexMinFilt);
ogl_init();//platform specific initialization
@ -441,7 +455,6 @@ void gr_palette_load( ubyte *pal )
}
gr_palette_step_up(0, 0, 0); // make ogl_setbrightness_internal get run so that menus get brightened too.
init_computed_colors();
}

View File

@ -32,7 +32,7 @@
#include "texmap.h"
#include "palette.h"
#include "rle.h"
#include "mono.h"
#include "console.h"
#include "u_mem.h"
#ifdef HAVE_LIBPNG
#include "pngfile.h"
@ -54,7 +54,7 @@
//change to 1 for lots of spew.
#if 0
#define glmprintf(a) mprintf(a)
#define glmprintf(0,a) con_printf(CON_DEBUG, a)
#else
#define glmprintf(a)
#endif
@ -71,6 +71,8 @@
unsigned char *ogl_pal=gr_palette;
int GL_needmipmaps=0;
float OglTexMagFilt=GL_NEAREST;
float OglTexMinFilt=GL_NEAREST;
int last_width=-1,last_height=-1;
int GL_TEXTURE_2D_enabled=-1;
@ -669,11 +671,11 @@ bool g3_draw_poly(int nv,g3s_point **pointlist)
}
void gr_upoly_tmap(int nverts, int *vert ){
mprintf((0,"gr_upoly_tmap: unhandled\n"));//should never get called
glmprintf((0,"gr_upoly_tmap: unhandled\n"));//should never get called
}
void draw_tmap_flat(grs_bitmap *bm,int nv,g3s_point **vertlist){
mprintf((0,"draw_tmap_flat: unhandled\n"));//should never get called
glmprintf((0,"draw_tmap_flat: unhandled\n"));//should never get called
}
extern void (*tmap_drawer_ptr)(grs_bitmap *bm,int nv,g3s_point **vertlist);
@ -707,7 +709,7 @@ bool g3_draw_tmap(int nv,g3s_point **pointlist,g3s_uvl *uvl_list,grs_bitmap *bm)
}
glEnd();
}else{
mprintf((0,"g3_draw_tmap: unhandled tmap_drawer %p\n",tmap_drawer_ptr));
glmprintf((0,"g3_draw_tmap: unhandled tmap_drawer %p\n",tmap_drawer_ptr));
}
return 0;
@ -954,10 +956,6 @@ void ogl_start_frame(void){
glLoadIdentity();//clear matrix
}
#ifndef NMONO
void merge_textures_stats(void);
#endif
void ogl_end_frame(void){
OGL_VIEWPORT(0,0,grd_curscreen->sc_w,grd_curscreen->sc_h);
glMatrixMode(GL_PROJECTION);
@ -1177,7 +1175,7 @@ int tex_format_verify(ogl_texture *tex){
tex->format=GL_RGBA;
break;
default:
mprintf((0,"...no tex format to fall back on\n"));
glmprintf((0,"...no tex format to fall back on\n"));
return 1;
}
glmprintf((0,"...falling back to %x\n",tex->internalformat));
@ -1290,8 +1288,8 @@ int ogl_loadtexture (unsigned char *data, int dxo, int dyo, ogl_texture *tex, in
OGL_BINDTEXTURE(tex->handle);
glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
if (tex->wantmip){
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GameArg.OglTexMagFilt);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GameArg.OglTexMinFilt);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, OglTexMagFilt);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, OglTexMinFilt);
}
else{
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@ -1337,7 +1335,7 @@ void ogl_loadbmtexture_f(grs_bitmap *bm, int flags)
sprintf(filename, "textures/%s.png", bitmapname);
if (read_png(filename, &pdata))
{
printf("%s: %ux%ux%i p=%i(%i) c=%i a=%i chans=%i\n", filename, pdata.width, pdata.height, pdata.depth, pdata.paletted, pdata.num_palette, pdata.color, pdata.alpha, pdata.channels);
con_printf(CON_DEBUG,"%s: %ux%ux%i p=%i(%i) c=%i a=%i chans=%i\n", filename, pdata.width, pdata.height, pdata.depth, pdata.paletted, pdata.num_palette, pdata.color, pdata.alpha, pdata.channels);
if (pdata.depth == 8 && pdata.color)
{
if (bm->gltexture == NULL)
@ -1350,7 +1348,7 @@ void ogl_loadbmtexture_f(grs_bitmap *bm, int flags)
}
else
{
printf("%s: unsupported texture format: must be rgb, rgba, or paletted, and depth 8\n", filename);
con_printf(CON_DEBUG,"%s: unsupported texture format: must be rgb, rgba, or paletted, and depth 8\n", filename);
free(pdata.data);
if (pdata.palette)
free(pdata.palette);

View File

@ -14,6 +14,7 @@
#include "error.h"
#include "u_mem.h"
#include "args.h"
#include "config.h"
static int curx=-1,cury=-1,curfull=0;

View File

@ -8,7 +8,6 @@
#endif
#include "error.h"
#include "mono.h"
#include "fix.h"
#include "vecmat.h"
#include "gr.h"
@ -18,11 +17,10 @@
#include "wall.h"
#include "newdemo.h"
#include "kconfig.h"
#include "console.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <digi.h>
#include <digi_audio.h>
@ -59,7 +57,7 @@ void digi_select_system(int n) {
switch (n) {
#ifdef USE_SDLMIXER
case SDLMIXER_SYSTEM:
printf("Using SDL_mixer library\n");
con_printf(CON_NORMAL,"Using SDL_mixer library\n");
fptr_init = digi_mixer_init;
fptr_close = digi_mixer_close;
fptr_reset = digi_mixer_reset;
@ -82,7 +80,7 @@ void digi_select_system(int n) {
#endif
case SDLAUDIO_SYSTEM:
default:
printf("Using plain old SDL audio\n");
con_printf(CON_NORMAL,"Using plain old SDL audio\n");
fptr_init = digi_audio_init;
fptr_close = digi_audio_close;
fptr_reset = digi_audio_reset;
@ -108,8 +106,8 @@ void digi_select_system(int n) {
/* Common digi functions */
#ifndef NDEBUG
static int digi_initialised = 0;
static int digi_max_channels = 16;
#endif
extern int digi_max_channels;
int digi_volume = SOUND_MAX_VOLUME;
int midi_volume = SOUND_MAX_VOLUME;
@ -139,8 +137,6 @@ int digi_find_channel(int soundno) { return fptr_find_channel(soundno); }
int digi_is_sound_playing(int soundno) { return fptr_is_sound_playing(soundno); }
int digi_is_channel_playing(int channel) { return fptr_is_channel_playing(channel); }
void digi_stop_all_channels() { fptr_stop_all_channels(); }
void digi_set_max_channels(int n) { }
int digi_get_max_channels() { return 0; }
void digi_set_digi_volume(int dvolume) { fptr_set_digi_volume(dvolume); }
void digi_play_midi_song(char * filename, char * melodic_bank, char * drum_bank, int loop ) { fptr_play_midi_song(filename, melodic_bank, drum_bank, loop); }
@ -162,8 +158,5 @@ void digi_debug()
if (digi_is_channel_playing(i))
n_voices++;
}
mprintf_at((0, 2, 0, "DIGI: Active Sound Channels: %d/%d (HMI says %d/32) ", n_voices, digi_max_channels, -1));
//mprintf_at((0, 3, 0, "DIGI: Number locked sounds: %d ", digi_total_locks ));
}
}
#endif

View File

@ -23,7 +23,6 @@
#include "pstypes.h"
#include "error.h"
#include "mono.h"
#include "fix.h"
#include "vecmat.h"
#include "gr.h"
@ -133,7 +132,7 @@ struct sound_slot {
static SDL_AudioSpec WaveSpec;
static int digi_max_channels = 16;
int digi_max_channels = 16;
static int next_channel = 0;
@ -272,7 +271,6 @@ int digi_audio_start_sound(short soundnum, fix volume, int pan, int looping, int
next_channel = 0;
if (next_channel == starting_channel)
{
mprintf((1, "OUT OF SOUND CHANNELS!!!\n"));
return -1;
}
}
@ -477,8 +475,6 @@ void digi_audio_play_midi_song( char * filename, char * melodic_bank, char * dru
digi_midi_song_playing = 1;
digi_set_midi_volume(midi_volume);
}
else
printf("hmp_open failed\n");
#endif
}
@ -516,8 +512,5 @@ void digi_audio_debug()
if (digi_is_channel_playing(i))
n_voices++;
}
mprintf_at((0, 2, 0, "DIGI: Active Sound Channels: %d/%d (HMI says %d/32) ", n_voices, digi_max_channels, -1));
//mprintf_at((0, 3, 0, "DIGI: Number locked sounds: %d ", digi_total_locks ));
}
#endif

View File

@ -22,12 +22,12 @@
#include "pstypes.h"
#include "error.h"
#include "mono.h"
#include "sounds.h"
#include "digi.h"
#include "digi_mixer.h"
#include "digi_mixer_music.h"
#include "jukebox.h"
#include "console.h"
#include "fix.h"
#include "gr.h" // needed for piggy.h
@ -66,12 +66,12 @@ Mix_Chunk SoundChunks[MAX_SOUNDS];
/* Initialise audio */
int digi_mixer_init() {
if (MIX_DIGI_DEBUG) printf("digi_init %d (SDL_Mixer)\n", MAX_SOUNDS);
if (MIX_DIGI_DEBUG) con_printf(CON_DEBUG,"digi_init %d (SDL_Mixer)\n", MAX_SOUNDS);
if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) Error("SDL audio initialisation failed: %s.", SDL_GetError());
if (Mix_OpenAudio(SAMPLE_RATE_44K, MIX_OUTPUT_FORMAT, MIX_OUTPUT_CHANNELS, SOUND_BUFFER_SIZE)) {
//edited on 10/05/98 by Matt Mueller - should keep running, just with no sound.
printf("\nError: Couldn't open audio: %s\n", SDL_GetError());
con_printf(CON_URGENT,"\nError: Couldn't open audio: %s\n", SDL_GetError());
return 1;
}
@ -90,7 +90,7 @@ int digi_mixer_init() {
/* Shut down audio */
void digi_mixer_close() {
if (MIX_DIGI_DEBUG) printf("digi_close (SDL_Mixer)\n");
if (MIX_DIGI_DEBUG) con_printf(CON_DEBUG,"digi_close (SDL_Mixer)\n");
if (!digi_initialised) return;
digi_initialised = 0;
Mix_CloseAudio();
@ -114,13 +114,13 @@ void mixdigi_convert_sound(int i) {
if (SoundChunks[i].abuf) return; //proceed only if not converted yet
if (data) {
if (MIX_DIGI_DEBUG) printf("converting %d (%d)\n", i, dlen);
if (MIX_DIGI_DEBUG) con_printf(CON_DEBUG,"converting %d (%d)\n", i, dlen);
SDL_BuildAudioCVT(&cvt, AUDIO_U8, 1, GameArg.SndDigiSampleRate, out_format, out_channels, out_freq);
cvt.buf = malloc(dlen * cvt.len_mult);
cvt.len = dlen;
memcpy(cvt.buf, data, dlen);
if (SDL_ConvertAudio(&cvt)) printf("conversion of %d failed\n", i);
if (SDL_ConvertAudio(&cvt)) con_printf(CON_DEBUG,"conversion of %d failed\n", i);
SoundChunks[i].abuf = cvt.buf;
SoundChunks[i].alen = dlen * cvt.len_mult;
@ -142,7 +142,7 @@ int digi_mixer_start_sound(short soundnum, fix volume, int pan, int looping, int
mixdigi_convert_sound(soundnum);
if (MIX_DIGI_DEBUG) printf("digi_start_sound %d, volume %d, pan %d (start=%d, end=%d)\n", soundnum, mix_vol, mix_pan, loop_start, loop_end);
if (MIX_DIGI_DEBUG) con_printf(CON_DEBUG,"digi_start_sound %d, volume %d, pan %d (start=%d, end=%d)\n", soundnum, mix_vol, mix_pan, loop_start, loop_end);
channel = Mix_PlayChannel(-1, &(SoundChunks[soundnum]), mix_loop);
Mix_SetPanning(channel, 255-mix_pan, mix_pan);
@ -164,7 +164,7 @@ void digi_mixer_set_channel_pan(int channel, int pan) {
void digi_mixer_stop_sound(int channel) {
if (!digi_initialised) return;
if (MIX_DIGI_DEBUG) printf("digi_stop_sound %d\n", channel);
if (MIX_DIGI_DEBUG) con_printf(CON_DEBUG,"digi_stop_sound %d\n", channel);
Mix_HaltChannel(channel);
}

View File

@ -40,16 +40,16 @@ void convert_hmp(char *filename, char *mid_filename) {
PHYSFS_file *mid_out = PHYSFSX_openWriteBuffered(mid_filename);
if (!mid_out) {
fprintf(stderr, "Error could not open: %s for writing: %s\n", mid_filename, PHYSFS_getLastError());
con_printf(CON_CRITICAL," could not open: %s for writing: %s\n", mid_filename, PHYSFS_getLastError());
return;
}
if (MIX_MUSIC_DEBUG) printf("convert_hmp: converting %s to %s\n", filename, mid_filename);
con_printf(CON_DEBUG,"convert_hmp: converting %s to %s\n", filename, mid_filename);
hmp_in = PHYSFSX_openReadBuffered(filename);
if (!hmp_in) {
fprintf(stderr, "Error could not open: %s\n", filename);
con_printf(CON_CRITICAL," could not open: %s\n", filename);
PHYSFS_close(mid_out);
return;
}
@ -60,13 +60,13 @@ void convert_hmp(char *filename, char *mid_filename) {
PHYSFS_close(hmp_in);
if (err) {
fprintf(stderr, "%s\n", err);
con_printf(CON_CRITICAL,"%s\n", err);
PHYSFS_delete(mid_filename);
return;
}
}
else {
if (MIX_MUSIC_DEBUG) printf("convert_hmp: %s already exists\n", mid_filename);
con_printf(CON_DEBUG,"convert_hmp: %s already exists\n", mid_filename);
}
}
@ -131,7 +131,7 @@ void mix_play_file(char *filename, int loop) {
Mix_HookMusicFinished(music_done);
}
else {
fprintf(stderr, "Music %s could not be loaded\n", real_filename);
con_printf(CON_CRITICAL,"Music %s could not be loaded\n", real_filename);
Mix_HaltMusic();
}
}

View File

@ -28,6 +28,7 @@
#include "vers_id.h"
#include "args.h"
#include "gamefont.h"
#include "config.h"
#ifdef _WIN32_WCE // should really be checking for "Pocket PC" somehow
# define LANDSCAPE
@ -180,7 +181,7 @@ int gr_set_mode(u_int32_t mode)
grd_curscreen->sc_mode = mode;
grd_curscreen->sc_w = w;
grd_curscreen->sc_h = h;
grd_curscreen->sc_aspect = fixdiv(grd_curscreen->sc_w*GameArg.GfxAspectX,grd_curscreen->sc_h*GameArg.GfxAspectY);
grd_curscreen->sc_aspect = fixdiv(grd_curscreen->sc_w*GameCfg.AspectX,grd_curscreen->sc_h*GameCfg.AspectY);
grd_curscreen->sc_canvas.cv_bitmap.bm_x = 0;
grd_curscreen->sc_canvas.cv_bitmap.bm_y = 0;
grd_curscreen->sc_canvas.cv_bitmap.bm_w = w;
@ -200,6 +201,8 @@ int gr_set_mode(u_int32_t mode)
gamefont_choose_game_font(w,h);
gr_palette_load(gr_palette);
gr_remap_color_fonts();
gr_remap_mono_fonts();
return 0;
}
@ -209,6 +212,8 @@ int gr_check_fullscreen(void){
}
int gr_toggle_fullscreen(void){
gr_remap_color_fonts();
gr_remap_mono_fonts();
sdl_video_flags^=SDL_FULLSCREEN;
SDL_WM_ToggleFullScreen(screen);
return (sdl_video_flags & SDL_FULLSCREEN)?1:0;
@ -229,7 +234,7 @@ int gr_init(int mode)
memset( grd_curscreen, 0, sizeof(grs_screen));
if (!GameArg.SysWindow)
if (!GameCfg.WindowMode && !GameArg.SysWindow)
sdl_video_flags|=SDL_FULLSCREEN;
//added 05/19/99 Matt Mueller - make HW surface optional
@ -361,7 +366,8 @@ void gr_palette_load( ubyte *pal )
SDL_SetColors(screen, colors, 0, 256);
// SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
init_computed_colors();
gr_remap_color_fonts();
gr_remap_color_fonts();
gr_remap_mono_fonts();
}
void gr_palette_read(ubyte * pal)

View File

@ -12,6 +12,7 @@
#include "digi_mixer_music.h"
#include "jukebox.h"
#include "error.h"
#include "console.h"
#define JUKEBOX_ARG "-jukebox"
#define MUSIC_HUDMSG_MAXLEN 40
@ -82,10 +83,10 @@ void jukebox_load() {
}
if (count)
{
printf("Jukebox: %d music file(s) found in %s\n", count, GameArg.SndJukebox);
con_printf(CON_DEBUG,"Jukebox: %d music file(s) found in %s\n", count, GameArg.SndJukebox);
jukebox_loaded = 1;
}
else { printf("Jukebox music could not be found!\n"); }
else { con_printf(CON_DEBUG,"Jukebox music could not be found!\n"); }
}
else
{ Int3(); } // should at least find a directory in some search path, otherwise how did D2X load?
@ -94,7 +95,7 @@ void jukebox_load() {
free(files);
}
}
else { printf("Jukebox already loaded\n"); }
else { con_printf(CON_DEBUG,"Jukebox already loaded\n"); }
}
void jukebox_play() {
@ -153,11 +154,11 @@ void jukebox_list() {
dl_item *curr;
if (!jukebox_loaded) return;
if (dl_is_empty(JukeboxSongs)) {
printf("* No songs have been found\n");
con_printf(CON_DEBUG,"* No songs have been found\n");
}
else {
for (curr = JukeboxSongs->first; curr != NULL; curr = curr->next) {
printf("* %s\n", (char *) curr->data);
con_printf(CON_DEBUG,"* %s\n", (char *) curr->data);
}
}
}

View File

@ -24,6 +24,7 @@
#include "error.h"
#include "args.h"
#include "rbaudio.h"
#include "console.h"
static SDL_CD *s_cd = NULL;
static int initialised = 0;
@ -99,7 +100,7 @@ void RBASetVolume(int volume)
level = volume * 3;
if ((level<0) || (level>255)) {
fprintf(stderr, "illegal volume value (allowed values 0-255)\n");
con_printf(CON_CRITICAL, "illegal volume value (allowed values 0-255)\n");
return;
}
@ -109,7 +110,7 @@ void RBASetVolume(int volume)
= volctrl.channel3
= level;
if ( ioctl(cdfile, CDROMVOLCTRL, &volctrl) == -1 ) {
fprintf(stderr, "CDROMVOLCTRL ioctl failed\n");
con_printf(CON_CRITICAL, "CDROMVOLCTRL ioctl failed\n");
return;
}
#endif

View File

@ -1,17 +0,0 @@
#ifndef __WINMAIN_H__
#define __WINMAIN_H__
#ifdef __cplusplus
extern "C" {
#endif
extern int InitMain (void);
extern void PumpMessages (void);
extern HWND g_hWnd;
#ifdef __cplusplus
}
#endif
#endif // __WINMAIN_H__

View File

@ -1,13 +0,0 @@
#include <stdio.h>
#include <stdarg.h>
void mopen() {}
void mclose() {}
void _mprintf(short n, char * format, ...) {
#ifndef NMONO
va_list args;
va_start(args, format );
vprintf(format, args);
va_end(args);
#endif
}

View File

@ -5,7 +5,7 @@
#include <winsock.h>
#include <wsipx.h>
#include "netdrv.h"
#include "mono.h"
#include "console.h"
static socket_t IPX_sock;
@ -35,7 +35,7 @@ static int IPXOpenSocket(int port)
sock = socket(AF_IPX, SOCK_DGRAM, NSPROTO_IPX);
if (sock == -1) {
mprintf((1,"IPX: could not open IPX socket.\n"));
con_printf(CON_URGENT,"IPX: could not open IPX socket.\n"));
return -1;
}
@ -43,7 +43,7 @@ static int IPXOpenSocket(int port)
/* Permit broadcast output */
if (setsockopt(sock, SOL_SOCKET, SO_BROADCAST,(const char *)&opt, sizeof(opt)) == -1)
{
mprintf((1,"IPX: could not set socket option for broadcast.\n"));
con_printf(CON_URGENT,"IPX: could not set socket option for broadcast.\n"));
return -1;
}
@ -56,7 +56,7 @@ static int IPXOpenSocket(int port)
/* now bind to this port */
if (bind(sock, (struct sockaddr *) &ipxs, sizeof(ipxs)) == -1)
{
mprintf((1,"IPX: could not bind socket to address\n"));
con_printf(CON_URGENT,"IPX: could not bind socket to address\n"));
closesocket( sock );
return -1;
}
@ -64,7 +64,7 @@ static int IPXOpenSocket(int port)
len = sizeof(ipxs2);
if (getsockname(sock,(struct sockaddr *)&ipxs2,&len) < 0)
{
mprintf((1,"IPX: could not get socket name in IPXOpenSocket\n"));
con_printf(CON_URGENT,"IPX: could not get socket name in IPXOpenSocket\n"));
closesocket( sock );
return -1;
}
@ -72,7 +72,7 @@ static int IPXOpenSocket(int port)
if (port == 0)
{
port = htons(ipxs2.sa_socket);
mprintf((1,"IPX: opened dynamic socket %04x\n", port));
con_printf(CON_URGENT,"IPX: opened dynamic socket %04x\n", port));
}
memcpy(MyAddress, ipxs2.sa_netnum, 4);
@ -89,7 +89,7 @@ static int IPXOpenSocket(int port)
static void IPXCloseSocket(void)
{
/* now close the file descriptor for the socket, and free it */
mprintf((1,"IPX: closing file descriptor on socket %x\n", IPX_sock.socket));
con_printf(CON_URGENT,"IPX: closing file descriptor on socket %x\n", IPX_sock.socket));
closesocket(IPX_sock.fd);
WSACleanup();
}

File diff suppressed because it is too large Load Diff

View File

@ -29,7 +29,6 @@
Graphics:
;-aspect<Y>x<X> use specified aspect
;-hud <n> Set hud mode. 0=normal 1-3=new
;-persistentdebris Enable persistent debris. Works in singleplayer only
;-lowresfont Force to use LowRes fonts
@ -39,11 +38,8 @@
OpenGL:
;-gl_mipmap Set gl texture filters to "standard" options for mipmapping
;-gl_trilinear Set gl texture filters to trilinear mipmapping
;-gl_transparency Enable transparency effects
;-gl_reticle <n> Use OGL reticle 0=never 1=above 320x* 2=always
;-gl_voodoo Force fullscreen mode only
;-gl_fixedfont Do not scale fonts to current resolution
;-gl_prshot Take clean screenshots - no HUD and DXX-Rebirth writing

View File

@ -1,4 +1,3 @@
/* $Id: iff.c,v 1.1.1.1 2006/03/17 19:52:26 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -22,10 +21,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include <conf.h>
#endif
#ifdef RCS
static char rcsid[] = "$Id: iff.c,v 1.1.1.1 2006/03/17 19:52:26 zicodxx Exp $";
#endif
#define COMPRESS 1 //do the RLE or not? (for debugging mostly)
#define WRITE_TINY 0 //should we write a TINY chunk?
@ -93,16 +88,6 @@ ubyte iff_has_transparency; // 0=no transparency, 1=iff_transparent_color is val
#define anim_sig MAKE_SIG('A','N','I','M')
#define dlta_sig MAKE_SIG('D','L','T','A')
#ifndef NDEBUG
//void printsig(int32_t s)
//{
// char *t=(char *) &s;
//
///* printf("%c%c%c%c",*(&s+3),*(&s+2),*(&s+1),s);*/
// printf("%c%c%c%c",t[3],t[2],t[1],t[0]);
//}
#endif
int32_t get_sig(PHYSFS_file *f)
{
int32_t s;
@ -205,11 +190,6 @@ int parse_body(PHYSFS_file *ifile,long len,iff_bitmap_header *bmheader)
for (wid_cnt=width,plane=0; PHYSFS_tell(ifile) < end_pos && p<data_end;) {
unsigned char c;
// if (old_cnt-cnt > 2048) {
// printf(".");
// old_cnt=cnt;
// }
if (wid_cnt == end_cnt) {
wid_cnt = width;
plane++;
@ -333,14 +313,9 @@ int parse_delta(PHYSFS_file *ifile,long len,iff_bitmap_header *bmheader)
// the buffer pointed to by raw_data is stuffed with a pointer to bitplane pixel data
void skip_chunk(PHYSFS_file *ifile,long len)
{
//int c,i;
int ilen;
ilen = (len+1) & ~1;
//printf( "Skipping %d chunk\n", ilen );
// for (i=0; i<ilen; i++ )
// c = cfgetc(ifile);
cfseek(ifile,ilen,SEEK_CUR);
}
@ -354,10 +329,6 @@ int iff_parse_ilbm_pbm(PHYSFS_file *ifile,long form_type,iff_bitmap_header *bmhe
start_pos = PHYSFS_tell(ifile);
end_pos = start_pos-4+form_len;
// printf(" %ld ",form_len);
// printsig(form_type);
// printf("\n");
if (form_type == pbm_sig)
bmheader->type = TYPE_PBM;
else
@ -367,18 +338,12 @@ int iff_parse_ilbm_pbm(PHYSFS_file *ifile,long form_type,iff_bitmap_header *bmhe
if (PHYSFS_readSBE32(ifile, &len)==EOF) break;
// printf(" ");
// printsig(sig);
// printf(" %ld\n",len);
switch (sig) {
case bmhd_sig: {
int ret;
int save_w=bmheader->w,save_h=bmheader->h;
//printf("Parsing header\n");
ret = parse_bmhd(ifile,len,bmheader);
if (ret != IFF_NO_ERROR)
@ -421,7 +386,6 @@ int iff_parse_ilbm_pbm(PHYSFS_file *ifile,long form_type,iff_bitmap_header *bmhe
int ncolors=(int) (len/3),cnum;
unsigned char r,g,b;
//printf("Parsing RGB map\n");
for (cnum=0;cnum<ncolors;cnum++) {
r=cfgetc(ifile);
g=cfgetc(ifile);
@ -442,7 +406,6 @@ int iff_parse_ilbm_pbm(PHYSFS_file *ifile,long form_type,iff_bitmap_header *bmhe
case body_sig:
{
int r;
//printf("Parsing body\n");
if ((r=parse_body(ifile,len,bmheader))!=IFF_NO_ERROR)
return r;
break;
@ -717,8 +680,6 @@ int write_pal(PHYSFS_file *ofile,iff_bitmap_header *bitmap_header)
// PHYSFS_writeSBE32(sizeof(pal_entry) * n_colors,ofile);
PHYSFS_writeSBE32(ofile, 3 * n_colors);
//printf("new write pal %d %d\n",3,n_colors);
for (i=0; i<256; i++) {
unsigned char r,g,b;
r = bitmap_header->palette[i].r * 4 + (bitmap_header->palette[i].r?3:0);
@ -729,9 +690,6 @@ int write_pal(PHYSFS_file *ofile,iff_bitmap_header *bitmap_header)
PHYSFSX_writeU8(ofile, b);
}
//printf("write pal %d %d\n",sizeof(pal_entry),n_colors);
// fwrite(bitmap_header->palette,sizeof(pal_entry),n_colors,ofile);
return IFF_NO_ERROR;
}
@ -904,8 +862,6 @@ int write_pbm(PHYSFS_file *ofile,iff_bitmap_header *bitmap_header,int compressio
long body_size,tiny_size,pbm_size = 4 + BMHD_SIZE + 8 + EVEN(raw_size) + sizeof(pal_entry)*(1<<bitmap_header->nplanes)+8;
long save_pos;
//printf("write_pbm\n");
put_sig(form_sig,ofile);
save_pos = PHYSFS_tell(ofile);
PHYSFS_writeSBE32(ofile, pbm_size+8);

View File

@ -1,205 +0,0 @@
#ifndef CON_console_H
#define CON_console_H
/*! \mainpage
\section intro Introduction
SDL_Console is a console that can be added to any SDL application. It is similar to Quake and other games consoles.
A console is meant to be a very simple way of interacting with a program and executing commands. You can also have
more than one console at a time.
\section docs Documentation
For a detailed description of all functions see \ref CON_console.h. Remark that functions that have the mark "Internal"
are only used internally. There's not much use of calling these functions.
Have Fun!
\author Garett Banuk <mongoose@mongeese.org> (Original Version)
\author Clemens Wacha <reflex-2000@gmx.net> (Version 2.x, Documentation)
\author Boris Lesner <talanthyr@tuxfamily.org> (Package Maintainer)
\author Bradley Bell <btb@icculus.org> (Descent Version)
*/
#include "gr.h"
#include "key.h"
//! Cut the buffer line if it becomes longer than this
#define CON_CHARS_PER_LINE 128
//! Cursor blink frequency in ms
#define CON_BLINK_RATE 500
//! Border in pixels from the most left to the first letter
#define CON_CHAR_BORDER 4
//! Spacing in pixels between lines
#define CON_LINE_SPACE 1
//! Default prompt used at the commandline
#define CON_DEFAULT_PROMPT "]"
//! Scroll this many lines at a time (when pressing PGUP or PGDOWN)
#define CON_LINE_SCROLL 2
//! Indicator showing that you scrolled up the history
#define CON_SCROLL_INDICATOR "^"
//! Cursor shown if we are in insert mode
#define CON_INS_CURSOR "_"
//! Cursor shown if we are in overwrite mode
#define CON_OVR_CURSOR "|"
//! Defines the default hide key (Hide() the console if pressed)
#define CON_DEFAULT_HIDEKEY KEY_ESC
//! Defines the opening/closing speed
#define CON_OPENCLOSE_SPEED 25
#ifdef __cplusplus
extern "C" {
#endif
enum {
CON_CLOSED, //! The console is closed (and not shown)
CON_CLOSING, //! The console is still open and visible but closing
CON_OPENING, //! The console is visible and opening but not yet fully open
CON_OPEN //! The console is open and visible
};
/*! This is a struct for each consoles data */
typedef struct console_information_td {
int Visible; //! enum that tells which visible state we are in CON_HIDE, CON_SHOW, CON_RAISE, CON_LOWER
int RaiseOffset; //! Offset used when scrolling in the console
int HideKey; //! the key that can hide the console
char **ConsoleLines; //! List of all the past lines
char **CommandLines; //! List of all the past commands
int TotalConsoleLines; //! Total number of lines in the console
int ConsoleScrollBack; //! How much the user scrolled back in the console
int TotalCommands; //! Number of commands in the Back Commands
int LineBuffer; //! The number of visible lines in the console (autocalculated)
int VChars; //! The number of visible characters in one console line (autocalculated)
char* Prompt; //! Prompt displayed in command line
char Command[CON_CHARS_PER_LINE]; //! current command in command line = lcommand + rcommand
char RCommand[CON_CHARS_PER_LINE]; //! left hand side of cursor
char LCommand[CON_CHARS_PER_LINE]; //! right hand side of cursor
char VCommand[CON_CHARS_PER_LINE]; //! current visible command line
int CursorPos; //! Current cursor position in CurrentCommand
int Offset; //! CommandOffset (first visible char of command) - if command is too long to fit into console
int InsMode; //! Insert or Overwrite characters?
grs_canvas *ConsoleSurface; //! Canvas of the console
grs_screen *OutputScreen; //! This is the screen to draw the console to
grs_bitmap *BackgroundImage; //! Background image for the console
grs_bitmap *InputBackground; //! Dirty rectangle to draw over behind the users background
int DispX, DispY; //! The top left x and y coords of the console on the display screen
#if 0
unsigned char ConsoleAlpha; //! The consoles alpha level
#endif
int CommandScrollBack; //! How much the users scrolled back in the command lines
void(*CmdFunction)(struct console_information_td *console, char* command); //! The Function that is executed if you press <Return> in the console
char*(*TabFunction)(char* command); //! The Function that is executed if you press <Tab> in the console
}
ConsoleInformation;
/*! Takes keys from the keyboard and inputs them to the console if the console isVisible().
If the event was not handled (i.e. WM events or unknown ctrl- or alt-sequences)
the function returns the event for further processing. */
int CON_Events(int event);
/*! Makes the console visible */
void CON_Show(ConsoleInformation *console);
/*! Hides the console */
void CON_Hide(ConsoleInformation *console);
/*! Returns 1 if the console is visible, 0 else */
int CON_isVisible(ConsoleInformation *console);
/*! Internal: Updates visible state. Used in CON_DrawConsole() */
void CON_UpdateOffset(ConsoleInformation* console);
/*! Draws the console to the screen if it isVisible()*/
void CON_DrawConsole(ConsoleInformation *console);
/*! Initializes a new console */
ConsoleInformation *CON_Init(grs_font *Font, grs_screen *DisplayScreen, int lines, int x, int y, int w, int h);
/*! Calls CON_Free */
void CON_Destroy(ConsoleInformation *console);
/*! Frees all the memory loaded by the console */
void CON_Free(ConsoleInformation *console);
/*! printf for the console */
void CON_Out(ConsoleInformation *console, const char *str, ...);
#if 0
/*! Sets the alpha channel of an SDL_Surface to the specified value (0 - transparend,
255 - opaque). Use this function also for OpenGL. */
void CON_Alpha(ConsoleInformation *console, unsigned char alpha);
/*! Internal: Sets the alpha channel of an SDL_Surface to the specified value.
Preconditions: the surface in question is RGBA. 0 <= a <= 255, where 0 is transparent and 255 opaque */
void CON_AlphaGL(SDL_Surface *s, int alpha);
/*! Sets a background image for the console */
#endif
int CON_Background(ConsoleInformation *console, grs_bitmap *image);
/*! Sets font info for the console */
void CON_Font(ConsoleInformation *console, grs_font *font, int fg, int bg);
/*! Changes current position of the console */
void CON_Position(ConsoleInformation *console, int x, int y);
/*! Changes the size of the console */
int CON_Resize(ConsoleInformation *console, int x, int y, int w, int h);
/*! Beams a console to another screen surface. Needed if you want to make a Video restart in your program. This
function first changes the OutputScreen Pointer then calls CON_Resize to adjust the new size. */
int CON_Transfer(ConsoleInformation* console, grs_screen* new_outputscreen, int x, int y, int w, int h);
/*! Give focus to a console. Make it the "topmost" console. This console will receive events
sent with CON_Events() */
void CON_Topmost(ConsoleInformation *console);
/*! Modify the prompt of the console */
void CON_SetPrompt(ConsoleInformation *console, char* newprompt);
/*! Set the key, that invokes a CON_Hide() after press. default is ESCAPE and you can always hide using
ESCAPE and the HideKey. compared against event->key.keysym.sym !! */
void CON_SetHideKey(ConsoleInformation *console, int key);
/*! Internal: executes the command typed in at the console (called if you press ENTER)*/
void CON_Execute(ConsoleInformation *console, char* command);
/*! Sets the callback function that is called if a command was typed in. The function could look like this:
void my_command_handler(ConsoleInformation* console, char* command). @param console: the console the command
came from. @param command: the command string that was typed in. */
void CON_SetExecuteFunction(ConsoleInformation *console, void(*CmdFunction)(ConsoleInformation *console2, char* command));
/*! Sets the callback tabulator completion function. char* my_tabcompletion(char* command). If Tab is
pressed, the function gets called with the already typed in command. my_tabcompletion then checks if if can
complete the command or if it should display a list of all matching commands (with CON_Out()). Returns the
completed command or NULL if no completion was made. */
void CON_SetTabCompletion(ConsoleInformation *console, char*(*TabFunction)(char* command));
/*! Internal: Gets called when TAB was pressed */
void CON_TabCompletion(ConsoleInformation *console);
/*! Internal: makes newline (same as printf("\n") or CON_Out(console, "\n") ) */
void CON_NewLineConsole(ConsoleInformation *console);
/*! Internal: shift command history (the one you can switch with the up/down keys) */
void CON_NewLineCommand(ConsoleInformation *console);
/*! Internal: updates console after resize etc. */
void CON_UpdateConsole(ConsoleInformation *console);
/*! Internal: Default Execute callback */
void Default_CmdFunction(ConsoleInformation *console, char* command);
/*! Internal: Default TabCompletion callback */
char* Default_TabFunction(char* command);
/*! Internal: draws the commandline the user is typing in to the screen. called by update? */
void DrawCommandLine();
/*! Internal: Gets called if you press the LEFT key (move cursor left) */
void Cursor_Left(ConsoleInformation *console);
/*! Internal: Gets called if you press the RIGHT key (move cursor right) */
void Cursor_Right(ConsoleInformation *console);
/*! Internal: Gets called if you press the HOME key (move cursor to the beginning
of the line */
void Cursor_Home(ConsoleInformation *console);
/*! Internal: Gets called if you press the END key (move cursor to the end of the line*/
void Cursor_End(ConsoleInformation *console);
/*! Internal: Called if you press DELETE (deletes character under the cursor) */
void Cursor_Del(ConsoleInformation *console);
/*! Internal: Called if you press BACKSPACE (deletes character left of cursor) */
void Cursor_BSpace(ConsoleInformation *console);
/*! Internal: Called if you type in a character (add the char to the command) */
void Cursor_Add(ConsoleInformation *console, int event);
/*! Internal: Called if you press Ctrl-C (deletes the commandline) */
void Clear_Command(ConsoleInformation *console);
/*! Internal: Called if you press Ctrl-L (deletes the History) */
void Clear_History(ConsoleInformation *console);
/*! Internal: Called if you press UP key (switches through recent typed in commands */
void Command_Up(ConsoleInformation *console);
/*! Internal: Called if you press DOWN key (switches through recent typed in commands */
void Command_Down(ConsoleInformation *console);
#ifdef __cplusplus
};
#endif
#endif

View File

@ -1,4 +1,3 @@
/* $Id: args.h,v 1.1.1.1 2006/03/17 20:01:30 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -11,6 +10,7 @@ CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*/
/*
*
* Prototypes for accessing arguments.
@ -65,22 +65,17 @@ typedef struct Arg
int SndSdlMixer;
char *SndExternalMusic;
char *SndJukebox;
float GfxAspectX;
float GfxAspectY;
int GfxGaugeHudMode;
int GfxPersistentDebris;
int GfxGaugeHudMode;// MOVE
int GfxPersistentDebris;// MOVE
int GfxHiresGFXAvailable;
int GfxHiresFNTAvailable;
int GfxMovieHires;
int GfxMovieSubtitles;
#ifdef OGL
int OglTexMagFilt;
int OglTexMinFilt;
int OglAlphaEffects;
int OglReticle;
int OglVoodooHack;
int OglAlphaEffects;// MOVE
int OglReticle;// MOVE
int OglFixedFont;
int OglPrShot;
int OglPrShot;// MOVE
#endif
int MplGameProfile;
int MplNoRankings;

View File

@ -35,6 +35,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "physfsx.h"
#include "strutil.h"
#include "ignorecase.h"
#include "console.h"
#define CFILE PHYSFS_file
#define cfopen(f,m) PHYSFSX_openReadBuffered(f)
@ -206,7 +207,7 @@ static inline int cfile_read_int(PHYSFS_file *file)
if (!PHYSFS_readSLE32(file, &i))
{
fprintf(stderr, "Error reading int in cfile_read_int()");
con_printf(CON_CRITICAL,"Error reading int in cfile_read_int()");
exit(1);
}
@ -219,7 +220,7 @@ static inline short cfile_read_short(PHYSFS_file *file)
if (!PHYSFS_readSLE16(file, &s))
{
fprintf(stderr, "Error reading short in cfile_read_short()");
con_printf(CON_CRITICAL,"Error reading short in cfile_read_short()");
exit(1);
}
@ -232,7 +233,7 @@ static inline sbyte cfile_read_byte(PHYSFS_file *file)
if (PHYSFS_read(file, &b, sizeof(b), 1) != 1)
{
fprintf(stderr, "Error reading byte in cfile_read_byte()");
con_printf(CON_CRITICAL,"Error reading byte in cfile_read_byte()");
exit(1);
}
@ -245,7 +246,7 @@ static inline fix cfile_read_fix(PHYSFS_file *file)
if (!PHYSFS_readSLE32(file, &f))
{
fprintf(stderr, "Error reading fix in cfile_read_fix()");
con_printf(CON_CRITICAL,"Error reading fix in cfile_read_fix()");
exit(1);
}
@ -258,7 +259,7 @@ static inline fixang cfile_read_fixang(PHYSFS_file *file)
if (!PHYSFS_readSLE16(file, &f))
{
fprintf(stderr, "Error reading fixang in cfile_read_fixang()");
con_printf(CON_CRITICAL,"Error reading fixang in cfile_read_fixang()");
exit(1);
}

View File

@ -1,21 +0,0 @@
#ifndef _CMD_H_
#define _CMD_H_ 1
/* Maximum length for a single command */
#define CMD_MAX_LENGTH 2048
/* Maximum number of tokens per command */
#define CMD_MAX_TOKENS 64
/* Parse an input string */
void cmd_parse(char *input);
typedef void (*xcommand_t)(void);
/* Warning: these commands are NOT REENTRANT. Do not attempt to thread them! */
void cmd_tokenize(char *string);
int cmd_argc(void);
char *cmd_argv(int w);
#endif /* _CMD_H_ */

View File

@ -1,50 +1,34 @@
/* Console */
#ifndef _CONSOLE_H_
#define _CONSOLE_H_ 1
#define _CONSOLE_H_
#include "pstypes.h"
/* Priority levels */
#define CON_CRITICAL -2
#define CON_URGENT -1
#define CON_CRITICAL -3
#define CON_URGENT -2
#define CON_HUD -1
#define CON_NORMAL 0
#define CON_VERBOSE 1
#define CON_DEBUG 2
int con_init(void);
void con_resize(void);
void con_printf(int level, char *fmt, ...);
#define CON_LINES_ONSCREEN 18
#define CON_SCROLL_OFFSET (CON_LINES_ONSCREEN - 3)
#define CON_LINES_MAX 128
#define CON_LINE_LENGTH 512
void con_show(void);
void con_draw(void);
void con_update(void);
int con_events(int key);
/* CVar stuff */
typedef struct cvar_s
typedef struct console_buffer
{
char *name;
char *string;
dboolean archive;
float value;
struct cvar_s *next;
} cvar_t;
char line[CON_LINE_LENGTH];
int priority;
} __pack__ console_buffer;
extern cvar_t *cvar_vars;
/* Register a CVar with the name and string and optionally archive elements set */
void cvar_registervariable (cvar_t *cvar);
/* Equivalent to typing <var_name> <value> at the console */
void cvar_set(char *cvar_name, char *value);
/* Get a CVar's value */
float cvar(char *cvar_name);
/* Console CVars */
/* How discriminating we are about which messages are displayed */
extern cvar_t con_threshold;
extern int con_render;
void con_init(void);
void con_printf(int level, char *fmt, ...);
void con_show(void);
int con_events(int key);
#endif /* _CONSOLE_H_ */

View File

@ -3,7 +3,7 @@
#ifndef _D_IO_H
#define _D_IO_H
#if (defined(__MSDOS__) && !defined(__DJGPP__)) || defined(__WINDOWS__)
#if (defined(__MSDOS__) && !defined(__DJGPP__)) || defined(_WIN32)
#include <io.h>
#else
#include <unistd.h>

View File

@ -1,49 +0,0 @@
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*/
#ifndef _MONO_H
#define _MONO_H
#include <stdio.h>
#include <stdarg.h>
#include "console.h"
static inline void _do_mprintf(int n, char *fmt, ...)
{
char buffer[1024];
va_list arglist;
va_start (arglist, fmt);
vsprintf (buffer, fmt, arglist);
va_end (arglist);
con_printf (CON_DEBUG, buffer);
}
#define mprintf(args) _do_mprintf args
#define minit()
#define mclose(n)
#define mopen( n, row, col, width, height, title )
#define mDumpD(window, int_var)
#define mDumpX(window, int_var)
#define mclear( n )
#define mprintf_at(args)
#define mputc( n, c )
#define mputc_at( n, row, col, c )
#define msetcursor( row, col )
#define mrefresh(n)
#endif

View File

@ -64,6 +64,8 @@ void ogl_init_shared_palette(void);
extern int gl_initialized;
extern int GL_needmipmaps;
extern float OglTexMagFilt;
extern float OglTexMinFilt;
extern int active_texture_unit;
void ogl_setActiveTexture(int t);

View File

@ -75,8 +75,6 @@ extern int Lighting_on;
// HACK INTERFACE: how far away the current segment (& thus texture) is
extern int Current_seg_depth;
extern int Max_perspective_depth; // Deepest segment at which perspective interpolation will be used.
extern int Max_linear_depth; // Deepest segment at which linear interpolation will be used.
extern int Max_flat_depth; // Deepest segment at which flat shading will be used. (If not flat shading, then what?)
// These are pointers to texture maps. If you want to render texture map #7, then you will render

View File

@ -1,4 +1,3 @@
/* $Id: timer.h,v 1.1.1.1 2006/03/17 20:01:31 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO

View File

@ -1,4 +1,3 @@
/* $Id: u_dpmi.h,v 1.1.1.1 2006/03/17 20:01:40 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO

View File

@ -1,4 +1,3 @@
/* $Id: u_mem.h,v 1.1.1.1 2006/03/17 20:01:31 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -12,6 +11,9 @@ AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*/
#ifndef _U_MEM_H
#define _U_MEM_H
#include <stdlib.h>
#ifdef MACINTOSH
@ -53,3 +55,5 @@ extern char *strdup(const char *str);
#define MALLOC( var, type, count ) (var=(type *)malloc((count)*sizeof(type)))
#endif
#endif // _U_MEM_H

View File

@ -1,16 +1,16 @@
/* $Id: vecmat.h,v 1.1.1.1 2006/03/17 20:01:30 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*/
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*/
/*
*
* Header file for vector/matrix library

View File

@ -5,6 +5,7 @@
#include <string.h>
#include "decoders.h"
#include "console.h"
static unsigned short *backBuf1, *backBuf2;
static int lookup_initialized;
@ -52,9 +53,9 @@ void decodeFrame16(unsigned char *pFrame, unsigned char *pMap, int mapRemain, un
/*
if (FramePtr < backBuf1)
fprintf(stderr, "danger! pointing out of bounds below after dispatch decoder: %d, %d (1) [%x]\n", i, j, (*pMap) & 0xf);
con_printf(CON_CRITICAL, "danger! pointing out of bounds below after dispatch decoder: %d, %d (1) [%x]\n", i, j, (*pMap) & 0xf);
else if (FramePtr >= backBuf1 + g_width*g_height)
fprintf(stderr, "danger! pointing out of bounds above after dispatch decoder: %d, %d (1) [%x]\n", i, j, (*pMap) & 0xf);
con_printf(CON_CRITICAL, "danger! pointing out of bounds above after dispatch decoder: %d, %d (1) [%x]\n", i, j, (*pMap) & 0xf);
*/
op = ((*pMap) >> 4) & 0xf;
@ -62,9 +63,9 @@ void decodeFrame16(unsigned char *pFrame, unsigned char *pMap, int mapRemain, un
/*
if (FramePtr < backBuf1)
fprintf(stderr, "danger! pointing out of bounds below after dispatch decoder: %d, %d (2) [%x]\n", i, j, (*pMap) >> 4);
con_printf(CON_CRITICAL, "danger! pointing out of bounds below after dispatch decoder: %d, %d (2) [%x]\n", i, j, (*pMap) >> 4);
else if (FramePtr >= backBuf1 + g_width*g_height)
fprintf(stderr, "danger! pointing out of bounds above after dispatch decoder: %d, %d (2) [%x]\n", i, j, (*pMap) >> 4);
con_printf(CON_CRITICAL, "danger! pointing out of bounds above after dispatch decoder: %d, %d (2) [%x]\n", i, j, (*pMap) >> 4);
*/
++pMap;
@ -75,7 +76,7 @@ void decodeFrame16(unsigned char *pFrame, unsigned char *pMap, int mapRemain, un
}
if ((length-(pData-pOrig)) != 0) {
fprintf(stderr, "DEBUG: junk left over: %d,%d,%d\n", (int)(pData-pOrig), length, (int)(length-(pData-pOrig)));
con_printf(CON_CRITICAL, "DEBUG: junk left over: %d,%d,%d\n", (int)(pData-pOrig), length, (int)(length-(pData-pOrig)));
}
}
@ -369,7 +370,7 @@ static void dispatchDecoder16(unsigned short **pFrame, unsigned char codeType, u
*pDataRemain -= 2;
break;
case 0x6:
fprintf(stderr, "STUB: encoding 6 not tested\n");
con_printf(CON_CRITICAL, "STUB: encoding 6 not tested\n");
for (i=0; i<2; i++)
{
*pFrame += 16;

View File

@ -4,6 +4,7 @@
#include <string.h>
#include "decoders.h"
#include "console.h"
static void dispatchDecoder(unsigned char **pFrame, unsigned char codeType, unsigned char **pData, int *pDataRemain, int *curXb, int *curYb);
@ -20,14 +21,14 @@ void decodeFrame8(unsigned char *pFrame, unsigned char *pMap, int mapRemain, uns
{
dispatchDecoder(&pFrame, (*pMap) & 0xf, &pData, &dataRemain, &i, &j);
if (pFrame < (unsigned char *)g_vBackBuf1)
fprintf(stderr, "danger! pointing out of bounds below after dispatch decoder: %d, %d (1) [%x]\n", i, j, (*pMap) & 0xf);
con_printf(CON_CRITICAL, "danger! pointing out of bounds below after dispatch decoder: %d, %d (1) [%x]\n", i, j, (*pMap) & 0xf);
else if (pFrame >= ((unsigned char *)g_vBackBuf1) + g_width*g_height)
fprintf(stderr, "danger! pointing out of bounds above after dispatch decoder: %d, %d (1) [%x]\n", i, j, (*pMap) & 0xf);
con_printf(CON_CRITICAL, "danger! pointing out of bounds above after dispatch decoder: %d, %d (1) [%x]\n", i, j, (*pMap) & 0xf);
dispatchDecoder(&pFrame, (*pMap) >> 4, &pData, &dataRemain, &i, &j);
if (pFrame < (unsigned char *)g_vBackBuf1)
fprintf(stderr, "danger! pointing out of bounds below after dispatch decoder: %d, %d (2) [%x]\n", i, j, (*pMap) >> 4);
con_printf(CON_CRITICAL, "danger! pointing out of bounds below after dispatch decoder: %d, %d (2) [%x]\n", i, j, (*pMap) >> 4);
else if (pFrame >= ((unsigned char *)g_vBackBuf1) + g_width*g_height)
fprintf(stderr, "danger! pointing out of bounds above after dispatch decoder: %d, %d (2) [%x]\n", i, j, (*pMap) >> 4);
con_printf(CON_CRITICAL, "danger! pointing out of bounds above after dispatch decoder: %d, %d (2) [%x]\n", i, j, (*pMap) >> 4);
++pMap;
--mapRemain;

View File

@ -39,6 +39,7 @@
#include "decoders.h"
#include "libmve.h"
#include "args.h"
#include "console.h"
#define MVE_OPCODE_ENDOFSTREAM 0x00
#define MVE_OPCODE_ENDOFCHUNK 0x01
@ -93,7 +94,7 @@ static unsigned int unhandled_chunks[32*256];
static int default_seg_handler(unsigned char major, unsigned char minor, unsigned char *data, int len, void *context)
{
unhandled_chunks[major<<8|minor]++;
//fprintf(stderr, "unknown chunk type %02x/%02x\n", major, minor);
//con_printf(CON_CRITICAL, "unknown chunk type %02x/%02x\n", major, minor);
return 1;
}
@ -268,7 +269,7 @@ static void mve_audio_callback(void *userdata, unsigned char *stream, int len)
if (mve_audio_bufhead == mve_audio_buftail)
return /* 0 */;
//fprintf(stderr, "+ <%d (%d), %d, %d>\n", mve_audio_bufhead, mve_audio_curbuf_curpos, mve_audio_buftail, len);
//con_printf(CON_CRITICAL, "+ <%d (%d), %d, %d>\n", mve_audio_bufhead, mve_audio_curbuf_curpos, mve_audio_buftail, len);
while (mve_audio_bufhead != mve_audio_buftail /* while we have more buffers */
&& len > (mve_audio_buflens[mve_audio_bufhead]-mve_audio_curbuf_curpos)) /* and while we need more data */
@ -290,7 +291,7 @@ static void mve_audio_callback(void *userdata, unsigned char *stream, int len)
mve_audio_curbuf_curpos = 0;
}
//fprintf(stderr, "= <%d (%d), %d, %d>: %d\n", mve_audio_bufhead, mve_audio_curbuf_curpos, mve_audio_buftail, len, total);
//con_printf(CON_CRITICAL, "= <%d (%d), %d, %d>: %d\n", mve_audio_bufhead, mve_audio_curbuf_curpos, mve_audio_buftail, len, total);
/* return total; */
if (len != 0 /* ospace remaining */
@ -316,7 +317,7 @@ static void mve_audio_callback(void *userdata, unsigned char *stream, int len)
}
}
//fprintf(stderr, "- <%d (%d), %d, %d>\n", mve_audio_bufhead, mve_audio_curbuf_curpos, mve_audio_buftail, len);
//con_printf(CON_CRITICAL, "- <%d (%d), %d, %d>\n", mve_audio_bufhead, mve_audio_curbuf_curpos, mve_audio_buftail, len);
}
#endif
@ -367,8 +368,8 @@ static int create_audiobuf_handler(unsigned char major, unsigned char minor, uns
}
if (!GameArg.SndSdlMixer) {
fprintf(stderr, "creating audio buffers:\n");
fprintf(stderr, "sample rate = %d, stereo = %d, bitsize = %d, compressed = %d\n",
con_printf(CON_CRITICAL, "creating audio buffers:\n");
con_printf(CON_CRITICAL, "sample rate = %d, stereo = %d, bitsize = %d, compressed = %d\n",
sample_rate, stereo, bitsize ? 16 : 8, compressed);
}
@ -383,11 +384,11 @@ static int create_audiobuf_handler(unsigned char major, unsigned char minor, uns
// MD2211: if using SDL_Mixer, we never reinit the sound system
if (!GameArg.SndSdlMixer) {
if (SDL_OpenAudio(mve_audio_spec, NULL) >= 0) {
fprintf(stderr, " success\n");
con_printf(CON_CRITICAL, " success\n");
mve_audio_canplay = 1;
}
else {
fprintf(stderr, " failure : %s\n", SDL_GetError());
con_printf(CON_CRITICAL, " failure : %s\n", SDL_GetError());
mve_audio_canplay = 0;
}
}
@ -490,7 +491,7 @@ static int audio_data_handler(unsigned char major, unsigned char minor, unsigned
memcpy(cvt.buf, mve_audio_buffers[mve_audio_buftail], nsamp);
// do the conversion
if (SDL_ConvertAudio(&cvt)) printf("audio conversion failed!\n");
if (SDL_ConvertAudio(&cvt)) con_printf(CON_DEBUG,"audio conversion failed!\n");
// copy back to the audio buffer
mve_free(mve_audio_buffers[mve_audio_buftail]); // free the old audio buffer
@ -504,7 +505,7 @@ static int audio_data_handler(unsigned char major, unsigned char minor, unsigned
mve_audio_buftail = 0;
if (mve_audio_buftail == mve_audio_bufhead)
fprintf(stderr, "d'oh! buffer ring overrun (%d)\n", mve_audio_bufhead);
con_printf(CON_CRITICAL, "d'oh! buffer ring overrun (%d)\n", mve_audio_bufhead);
}
if (mve_audio_playing)
@ -571,7 +572,7 @@ static int create_videobuf_handler(unsigned char major, unsigned char minor, uns
memset(g_vBackBuf1, 0, g_width * g_height * 4);
#ifdef DEBUG
fprintf(stderr, "DEBUG: w,h=%d,%d count=%d, tc=%d\n", w, h, count, truecolor);
con_printf(CON_CRITICAL, "DEBUG: w,h=%d,%d count=%d, tc=%d\n", w, h, count, truecolor);
#endif
g_truecolor = truecolor;

View File

@ -23,15 +23,13 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include <conf.h>
#endif
char ai_rcsid[] = "$Id: ai.c,v 1.1.1.1 2006/03/17 19:54:45 zicodxx Exp $";
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "inferno.h"
#include "game.h"
#include "mono.h"
#include "console.h"
#include "3d.h"
#include "object.h"
@ -291,16 +289,12 @@ void make_nearby_robot_snipe(void)
if ((objp->ctype.ai_info.behavior != AIB_SNIPE) && (objp->ctype.ai_info.behavior != AIB_RUN_FROM) && !Robot_info[objp->id].boss_flag && !robptr->companion) {
objp->ctype.ai_info.behavior = AIB_SNIPE;
Ai_local_info[objnum].mode = AIM_SNIPE_ATTACK;
mprintf((0, "Making robot #%i go into snipe mode!\n", objnum));
return;
}
}
objnum = objp->next;
}
}
mprintf((0, "Couldn't find a robot to make snipe!\n"));
}
int Ai_last_missile_camera;
@ -357,8 +351,6 @@ void do_ai_frame(object *obj)
if ((aip->behavior == AIB_RUN_FROM) && (ailp->mode != AIM_RUN_FROM_OBJECT))
Int3(); // This is peculiar. Behavior is run from, but mode is not. Contact Mike.
mprintf_animation_info((obj));
if (!Do_ai_flag)
return;
@ -367,12 +359,8 @@ void do_ai_frame(object *obj)
Int3(); // Contact Mike: This is a debug break
#endif
//mprintf((0, "Object %i: behavior = %02x, mode = %i, awareness = %i, time = %7.3f\n", obj-Objects, aip->behavior, ailp->mode, ailp->player_awareness_type, f2fl(ailp->player_awareness_time)));
//mprintf((0, "Object %i: behavior = %02x, mode = %i, awareness = %i, cur=%i, goal=%i\n", obj-Objects, aip->behavior, ailp->mode, ailp->player_awareness_type, aip->CURRENT_STATE, aip->GOAL_STATE));
//Assert((aip->behavior >= MIN_BEHAVIOR) && (aip->behavior <= MAX_BEHAVIOR));
if (!((aip->behavior >= MIN_BEHAVIOR) && (aip->behavior <= MAX_BEHAVIOR))) {
//mprintf((0, "Object %i behavior is %i, setting to AIB_NORMAL, fix in editor!\n", objnum, aip->behavior));
aip->behavior = AIB_NORMAL;
}
@ -443,8 +431,6 @@ _exit_cheat:
}
}
dist_to_player = vm_vec_dist_quick(&Believed_player_pos, &obj->pos);
//if (robptr->companion)
// mprintf((0, "%3i: %3i %8.3f %8s %8s [%3i %4i]\n", objnum, obj->segnum, f2fl(dist_to_player), mode_text[ailp->mode], behavior_text[aip->behavior-0x80], aip->hide_index, aip->path_length));
// If this robot can fire, compute visibility from gun position.
// Don't want to compute visibility twice, as it is expensive. (So is call to calc_gun_point).
@ -459,22 +445,14 @@ _exit_cheat:
} else {
vis_vec_pos = obj->pos;
vm_vec_zero(&gun_point);
//mprintf((0, "Visibility = %i, computed from center.\n", player_visibility));
}
// MK: Debugging, July 26, 1995!
// if (objnum == 1)
// {
// compute_vis_and_vec(obj, &vis_vec_pos, ailp, &vec_to_player, &player_visibility, robptr, &visibility_and_vec_computed);
// mprintf((0, "Frame %i: dist=%7.3f, vecdot = %7.3f, mode=%i\n", FrameCount, f2fl(dist_to_player), f2fl(vm_vec_dot(&vec_to_player, &obj->orient.fvec)), ailp->mode));
// }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Occasionally make non-still robots make a path to the player. Based on agitation and distance from player.
if ((aip->behavior != AIB_SNIPE) && (aip->behavior != AIB_RUN_FROM) && (aip->behavior != AIB_STILL) && !(Game_mode & GM_MULTI) && (robptr->companion != 1) && (robptr->thief != 1))
if (Overall_agitation > 70) {
if ((dist_to_player < F1_0*200) && (d_rand() < FrameTime/4)) {
if (d_rand() * (Overall_agitation - 40) > F1_0*5) {
// -- mprintf((0, "(1) Object #%i going from still to path in frame %i.\n", objnum, FrameCount));
create_path_to_player(obj, 4 + Overall_agitation/8 + Difficulty_level, 1);
return;
}
@ -493,14 +471,12 @@ _exit_cheat:
if (ailp->consecutive_retries > 3) {
switch (ailp->mode) {
case AIM_GOTO_PLAYER:
// -- mprintf((0, "Buddy stuck going to player...\n"));
// -- Buddy_got_stuck = 1;
move_towards_segment_center(obj);
create_path_to_player(obj, 100, 1);
// -- Buddy_got_stuck = 0;
break;
case AIM_GOTO_OBJECT:
// -- mprintf((0, "Buddy stuck going to object...\n"));
Escort_goal_object = ESCORT_GOAL_UNSPECIFIED;
//if (obj->segnum == ConsoleObject->segnum) {
// if (Point_segs[aip->hide_index + aip->cur_path_index].segnum == obj->segnum)
@ -509,7 +485,6 @@ _exit_cheat:
//}
break;
case AIM_CHASE_OBJECT:
// -- mprintf((0, "(2) Object #%i, retries while chasing, creating path to player in frame %i\n", objnum, FrameCount));
create_path_to_player(obj, 4 + Overall_agitation/8 + Difficulty_level, 1);
break;
case AIM_STILL:
@ -519,7 +494,6 @@ _exit_cheat:
attempt_to_resume_path(obj);
break;
case AIM_FOLLOW_PATH:
// mprintf((0, "Object %i following path got %i retries in frame %i\n", obj-Objects, ailp->consecutive_retries, FrameCount));
if (Game_mode & GM_MULTI) {
ailp->mode = AIM_STILL;
} else
@ -534,7 +508,6 @@ _exit_cheat:
ailp->mode = AIM_RUN_FROM_OBJECT;
break;
case AIM_BEHIND:
mprintf((0, "Hiding robot (%i) collided much.\n", obj-Objects));
move_towards_segment_center(obj);
obj->mtype.phys_info.velocity.x = 0;
obj->mtype.phys_info.velocity.y = 0;
@ -620,18 +593,14 @@ _exit_cheat:
rval = d_rand();
sval = (dist_to_player * (Difficulty_level+1))/64;
// -- mprintf((0, "Object #%3i: dist = %7.3f, rval = %8x, sval = %8x", obj-Objects, f2fl(dist_to_player), rval, sval));
if ((fixmul(rval, sval) < FrameTime) || (Players[Player_num].flags & PLAYER_FLAGS_HEADLIGHT_ON)) {
ailp->player_awareness_type = PA_PLAYER_COLLISION;
ailp->player_awareness_time = F1_0*3;
compute_vis_and_vec(obj, &vis_vec_pos, ailp, &vec_to_player, &player_visibility, robptr, &visibility_and_vec_computed);
if (player_visibility == 1) {
player_visibility = 2;
// -- mprintf((0, "...SWITCH!"));
}
}
// -- mprintf((0, "\n"));
}
@ -645,7 +614,6 @@ _exit_cheat:
object_animates = do_silly_animation(obj);
if (object_animates)
ai_frame_animation(obj);
//mprintf((0, "Object %i: goal=%i, current=%i\n", obj-Objects, obj->ctype.ai_info.GOAL_STATE, obj->ctype.ai_info.CURRENT_STATE));
} else {
// If Object is supposed to animate, but we don't let it animate due to distance, then
// we must change its state, else it will never update.
@ -659,7 +627,7 @@ _exit_cheat:
case 1:
case 2:
mprintf((1, "Warning: D1 boss detected. Not supported!\n"));
// FIXME!!!!
break;
default:
@ -698,8 +666,6 @@ _exit_cheat:
if (dist_to_player > F1_0*250) // station guys not at home always processed until 250 units away.
return;
} else if ((!ailp->previous_visibility) && ((dist_to_player >> 7) > ailp->time_since_processed)) { // 128 units away (6.4 segments) processed after 1 second.
if (robptr->thief)
mprintf((0, "T"));
return;
}
#ifndef NDEBUG
@ -793,7 +759,6 @@ _exit_cheat:
if ((dobjp->type == OBJ_WEAPON) && (dobjp->signature == obj->ctype.ai_info.danger_laser_signature)) {
fix circle_distance;
// -- mprintf((0, "Evading! "));
circle_distance = robptr->circle_distance[Difficulty_level] + ConsoleObject->size;
ai_move_relative_to_player(obj, ailp, dist_to_player, &vec_to_player, circle_distance, 1, player_visibility);
}
@ -808,10 +773,8 @@ _exit_cheat:
else if (openable_doors_in_segment(Point_segs[aip->hide_index + aip->cur_path_index + 2*aip->PATH_DIR].segnum) != -1)
do_stuff = 1;
else if ((ailp->mode == AIM_GOTO_PLAYER) && (dist_to_player < 3*MIN_ESCORT_DISTANCE/2) && (vm_vec_dot(&ConsoleObject->orient.fvec, &vec_to_player) > -F1_0/4)) {
// mprintf((0, "Firing at player because dot = %7.3f\n", f2fl(vm_vec_dot(&ConsoleObject->orient.fvec, &vec_to_player))));
do_stuff = 1;
} else
; // mprintf((0, "Not Firing at player because dot = %7.3f, dist = %7.3f\n", f2fl(vm_vec_dot(&ConsoleObject->orient.fvec, &vec_to_player)), f2fl(dist_to_player)));
}
if (do_stuff) {
Laser_create_new_easy( &obj->orient.fvec, &obj->pos, obj-Objects, FLARE_ID, 1);
@ -861,13 +824,11 @@ _exit_cheat:
// @mk, 12/27/94, structure here was strange. Would do both clauses of what are now this if/then/else. Used to be if/then, if/then.
if ((player_visibility < 2) && (previous_visibility == 2)) { // this is redundant: mk, 01/15/95: && (ailp->mode == AIM_CHASE_OBJECT)) {
// -- mprintf((0, "I used to be able to see the player!\n"));
if (!ai_multiplayer_awareness(obj, 53)) {
if (maybe_ai_do_actual_firing_stuff(obj, aip))
ai_do_actual_firing_stuff(obj, aip, ailp, robptr, &vec_to_player, dist_to_player, &gun_point, player_visibility, object_animates, aip->CURRENT_GUN);
return;
}
// -- mprintf((0, "(3) Object #%i going from chase to player path in frame %i.\n", objnum, FrameCount));
create_path_to_player(obj, 8, 1);
ai_multi_send_robot_position(objnum, -1);
} else if ((player_visibility == 0) && (dist_to_player > F1_0*80) && (!(Game_mode & GM_MULTI))) {
@ -876,7 +837,6 @@ _exit_cheat:
// This has one desirable benefit of avoiding physics retries.
if (aip->behavior == AIB_STATION) {
ailp->goal_segment = aip->hide_segment;
// -- mprintf((0, "(1) Object #%i going from chase to STATION in frame %i.\n", objnum, FrameCount));
create_path_to_station(obj, 15);
} // -- this looks like a dumb thing to do...robots following paths far away from you! else create_n_segment_path(obj, 5, -1);
break;
@ -886,7 +846,6 @@ _exit_cheat:
if (player_visibility) {
if (d_rand() < FrameTime*player_visibility) {
if (dist_to_player/256 < d_rand()*player_visibility) {
// mprintf((0, "Object %i searching for player.\n", obj-Objects));
aip->GOAL_STATE = AIS_SRCH;
aip->CURRENT_STATE = AIS_SRCH;
}
@ -907,9 +866,6 @@ _exit_cheat:
ai_do_actual_firing_stuff(obj, aip, ailp, robptr, &vec_to_player, dist_to_player, &gun_point, player_visibility, object_animates, aip->CURRENT_GUN);
return;
}
// -- bad idea, robots charge player they've never seen! -- mprintf((0, "(4) Object #%i going from chase to player path in frame %i.\n", objnum, FrameCount));
// -- bad idea, robots charge player they've never seen! -- create_path_to_player(obj, 10, 1);
// -- bad idea, robots charge player they've never seen! -- ai_multi_send_robot_position(objnum, -1);
} else if ((aip->CURRENT_STATE != AIS_REST) && (aip->GOAL_STATE != AIS_REST)) {
if (!ai_multiplayer_awareness(obj, 70)) {
if (maybe_ai_do_actual_firing_stuff(obj, aip))
@ -1008,7 +964,6 @@ _exit_cheat:
if (aip->behavior == AIB_STATION)
if (Point_segs[aip->hide_index + aip->path_length - 1].segnum == aip->hide_segment) {
anger_level = 64;
// mprintf((0, "Object %i, station, lowering anger to 64.\n"));
}
compute_vis_and_vec(obj, &vis_vec_pos, ailp, &vec_to_player, &player_visibility, robptr, &visibility_and_vec_computed);
@ -1073,16 +1028,13 @@ _exit_cheat:
if (dot > 0) { // Remember, we're interested in the rear vector dot being < 0.
goal_vector = ConsoleObject->orient.fvec;
vm_vec_negate(&goal_vector);
// -- mprintf((0, "Goal is BEHIND\n"));
} else {
fix dot;
dot = vm_vec_dot(&ConsoleObject->orient.rvec, &vec_to_player);
goal_vector = ConsoleObject->orient.rvec;
if (dot > 0) {
vm_vec_negate(&goal_vector);
// -- mprintf((0, "Goal is LEFT\n"));
} else
; // -- mprintf((0, "Goal is RIGHT\n"));
}
}
vm_vec_scale(&goal_vector, 2*(ConsoleObject->size + obj->size + (((objnum*4 + FrameCount) & 63) << 12)));
@ -1158,7 +1110,6 @@ _exit_cheat:
// This has one desirable benefit of avoiding physics retries.
if (aip->behavior == AIB_STATION) {
ailp->goal_segment = aip->hide_segment;
// -- mprintf((0, "(2) Object #%i going from STILL to STATION in frame %i.\n", objnum, FrameCount));
create_path_to_station(obj, 15);
}
break;
@ -1207,7 +1158,6 @@ _exit_cheat:
break;
default:
mprintf((0, "Unknown mode = %i in robot %i, behavior = %i\n", ailp->mode, obj-Objects, aip->behavior));
ailp->mode = AIM_CHASE_OBJECT;
break;
} // end: switch (ailp->mode) {
@ -1227,7 +1177,6 @@ _exit_cheat:
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if (!object_animates) {
aip->CURRENT_STATE = aip->GOAL_STATE;
// mprintf((0, "Setting current to goal (%i) because object doesn't animate.\n", aip->GOAL_STATE));
}
Assert(ailp->player_awareness_type <= AIE_MAX);
@ -1281,7 +1230,6 @@ _exit_cheat:
if (aip->GOAL_STATE == AIS_REST) {
compute_vis_and_vec(obj, &vis_vec_pos, ailp, &vec_to_player, &player_visibility, robptr, &visibility_and_vec_computed);
if (ready_to_fire(robptr, ailp) && (player_visibility)) {
// mprintf((0, "Setting goal state to fire from rest.\n"));
aip->GOAL_STATE = AIS_FIRE;
}
}
@ -1340,10 +1288,8 @@ _exit_cheat:
}
break;
case AIS_FLIN:
// mprintf((0, "State = flinch, goal = %i.\n", aip->GOAL_STATE));
break;
default:
mprintf((1, "Unknown mode for AI object #%i\n", objnum));
aip->GOAL_STATE = AIS_REST;
aip->CURRENT_STATE = AIS_REST;
break;
@ -1682,13 +1628,6 @@ int ai_restore_state(PHYSFS_file *fp, int version)
if (Num_boss_teleport_segs)
PHYSFS_read(fp, Boss_teleport_segs, sizeof(Boss_teleport_segs[0]), Num_boss_teleport_segs);
} else {
// -- Num_boss_teleport_segs = 1;
// -- Num_boss_gate_segs = 1;
// -- Boss_teleport_segs[0] = 0;
// -- Boss_gate_segs[0] = 0;
// Note: Maybe better to leave alone...will probably be ok.
mprintf((1, "Warning: If you fight the boss, he might teleport to segment #0!\n"));
}
return 1;

View File

@ -1,4 +1,3 @@
/* $Id: ai.h,v 1.1.1.1 2006/03/17 19:54:46 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -80,7 +79,6 @@ extern void init_ai_object(int objnum, int initial_mode, int hide_segment);
extern void update_player_awareness(object *objp, fix new_awareness);
extern void create_awareness_event(object *objp, int type); // object *objp can create awareness of player, amount based on "type"
extern void do_ai_frame_all(void);
extern void init_ai_system(void);
extern void reset_ai_states(object *objp);
extern int create_path_points(object *objp, int start_seg, int end_seg, point_seg *point_segs, short *num_points, int max_depth, int random_flag, int safety_flag, int avoid_seg);
extern void create_all_paths(void);
@ -294,8 +292,6 @@ extern char state_text[8][5];
extern int Do_ai_flag, Break_on_object;
extern void mprintf_animation_info(object *objp);
#endif //ifndef NDEBUG
extern int Stolen_item_index; // Used in ai.c for controlling rate of Thief flare firing.

View File

@ -1,4 +1,3 @@
/* $Id: ai2.c,v 1.1.1.1 2006/03/17 19:55:06 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -22,17 +21,12 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include <conf.h>
#endif
#ifdef RCS
static char rcsid[] = "$Id: ai2.c,v 1.1.1.1 2006/03/17 19:55:06 zicodxx Exp $";
#endif
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "inferno.h"
#include "game.h"
#include "mono.h"
#include "3d.h"
#include "u_mem.h"
@ -94,31 +88,6 @@ short Boss_teleport_segs[MAX_BOSS_TELEPORT_SEGS];
int Num_boss_gate_segs;
short Boss_gate_segs[MAX_BOSS_TELEPORT_SEGS];
// ---------------------------------------------------------
// On entry, N_robot_types had darn sure better be set.
// Mallocs N_robot_types robot_info structs into global Robot_info.
void init_ai_system(void)
{
#if 0
int i;
mprintf((0, "Trying to malloc %i bytes for Robot_info.\n", N_robot_types * sizeof(*Robot_info)));
Robot_info = (robot_info *) d_malloc( N_robot_types * sizeof(*Robot_info) );
mprintf((0, "Robot_info = %i\n", Robot_info));
for (i=0; i<N_robot_types; i++) {
Robot_info[i].field_of_view = F1_0/2;
Robot_info[i].firing_wait = F1_0;
Robot_info[i].turn_time = F1_0*2;
// -- Robot_info[i].fire_power = F1_0;
// -- Robot_info[i].shield = F1_0/2;
Robot_info[i].max_speed = F1_0*10;
Robot_info[i].always_0xabcd = 0xabcd;
}
#endif
}
// ---------------------------------------------------------------------------------------------------------------------
// Given a behavior, set initial mode.
int ai_behavior_to_mode(int behavior)
@ -155,11 +124,9 @@ void init_ai_object(int objnum, int behavior, int hide_segment)
robot_info *robptr = &Robot_info[objp->id];
if (behavior == 0) {
// mprintf((0, "Behavior of 0 for object #%i, bashing to AIB_NORMAL.\n", objnum));
behavior = AIB_NORMAL;
aip->behavior = behavior;
}
// mprintf((0, "Initializing object #%i\n", objnum));
// mode is now set from the Robot dialog, so this should get overwritten.
ailp->mode = AIM_STILL;
@ -170,7 +137,6 @@ void init_ai_object(int objnum, int behavior, int hide_segment)
aip->behavior = behavior;
ailp->mode = ai_behavior_to_mode(aip->behavior);
} else if (!((aip->behavior >= MIN_BEHAVIOR) && (aip->behavior <= MAX_BEHAVIOR))) {
mprintf((0, "[obj %i -> normal] ", objnum));
aip->behavior = AIB_NORMAL;
}
@ -241,7 +207,6 @@ void create_buddy_bot(void)
break;
if (buddy_id == N_robot_types) {
mprintf((0, "Can't create Buddy. No 'companion' bot found in Robot_info!\n"));
return;
}
@ -271,7 +236,6 @@ void init_boss_segments(short segptr[], int *num_segs, int size_check, int one_w
if (size_check)
mprintf((0, "Boss fits in segments:\n"));
// See if there is a boss. If not, quick out.
for (i=0; i<=Highest_object_index; i++)
if ((Objects[i].type == OBJ_ROBOT) && (Robot_info[Objects[i].id].boss_flag)) {
@ -298,7 +262,6 @@ if (size_check)
seg_queue[head++] = original_boss_seg;
segptr[(*num_segs)++] = original_boss_seg;
mprintf((0, "%4i ", original_boss_seg));
#ifdef EDITOR
Selected_segs[N_selected_segs++] = original_boss_seg;
#endif
@ -336,12 +299,10 @@ if (size_check)
if ((!size_check) || boss_fits_in_seg(boss_objp, segp->children[sidenum])) {
segptr[(*num_segs)++] = segp->children[sidenum];
if (size_check) mprintf((0, "%4i ", segp->children[sidenum]));
#ifdef EDITOR
Selected_segs[N_selected_segs++] = segp->children[sidenum];
#endif
if (*num_segs >= MAX_BOSS_TELEPORT_SEGS) {
mprintf((1, "Warning: Too many boss teleport segments. Found %i after searching %i/%i segments.\n", MAX_BOSS_TELEPORT_SEGS, segp->children[sidenum], Highest_segment_index+1));
tail = head;
}
}
@ -458,13 +419,10 @@ void set_rotvel_and_saturate(fix *dest, fix delta)
{
if ((delta ^ *dest) < 0) {
if (abs(delta) < F1_0/8) {
// mprintf((0, "D"));
*dest = delta/4;
} else
// mprintf((0, "d"));
*dest = delta;
} else {
// mprintf((0, "!"));
*dest = delta;
}
}
@ -507,7 +465,6 @@ void ai_turn_towards_vector(vms_vector *goal_vector, object *objp, fix rate)
vm_vec_add2(&new_fvec, &objp->orient.fvec);
mag = vm_vec_normalize_quick(&new_fvec);
if (mag < F1_0/256) {
mprintf((1, "Degenerate vector in ai_turn_towards_vector (mag = %7.3f)\n", f2fl(mag)));
new_fvec = *goal_vector; // if degenerate vector, go right to goal
}
}
@ -579,11 +536,9 @@ int player_is_visible_from_object(object *objp, vms_vector *pos, fix field_of_vi
if (segnum == -1) {
fq.startseg = objp->segnum;
*pos = objp->pos;
mprintf((1, "Object %i, gun is outside mine, moving towards center.\n", objp-Objects));
move_towards_segment_center(objp);
} else {
if (segnum != objp->segnum) {
// -- mprintf((0, "Warning: Robot's gun tip not in same segment as robot center, frame %i.\n", FrameCount));
objp->ctype.ai_info.SUB_FLAGS |= SUB_FLAGS_GUNSEG;
}
fq.startseg = segnum;
@ -604,7 +559,6 @@ int player_is_visible_from_object(object *objp, vms_vector *pos, fix field_of_vi
// -- when we stupidly checked objects -- if ((Hit_type == HIT_NONE) || ((Hit_type == HIT_OBJECT) && (Hit_data.hit_object == Players[Player_num].objnum))) {
if (Hit_type == HIT_NONE) {
dot = vm_vec_dot(vec_to_player, &objp->orient.fvec);
// mprintf((0, "Fvec = [%5.2f %5.2f %5.2f], vec_to_player = [%5.2f %5.2f %5.2f], dot = %7.3f\n", f2fl(objp->orient.fvec.x), f2fl(objp->orient.fvec.y), f2fl(objp->orient.fvec.z), f2fl(vec_to_player->x), f2fl(vec_to_player->y), f2fl(vec_to_player->z), f2fl(dot)));
if (dot > field_of_view - (Overall_agitation << 9)) {
return 2;
} else {
@ -634,7 +588,6 @@ int do_silly_animation(object *objp)
attack_type = Robot_info[robot_type].attack_type;
if (num_guns == 0) {
// mprintf((0, "Object #%i of type #%i has 0 guns.\n", objp-Objects, robot_type));
return 0;
}
@ -1068,8 +1021,6 @@ void ai_fire_laser_at_player(object *obj, vms_vector *fire_point, int gun_num, v
}
}
// -- mprintf((0, "Firing from gun #%i at time = %7.3f\n", gun_num, f2fl(GameTime)));
// Set position to fire at based on difficulty level and robot's aiming ability
aim = FIRE_K*F1_0 - (FIRE_K-1)*(robptr->aim << 8); // F1_0 in bitmaps.tbl = same as used to be. Worst is 50% more error.
@ -1423,56 +1374,6 @@ void make_random_vector(vms_vector *vec)
vm_vec_normalize_quick(vec);
}
#ifndef NDEBUG
void mprintf_animation_info(object *objp)
{
ai_static *aip = &objp->ctype.ai_info;
ai_local *ailp = &Ai_local_info[objp-Objects];
if (!Ai_info_enabled)
return;
mprintf((0, "Goal = "));
switch (aip->GOAL_STATE) {
case AIS_NONE: mprintf((0, "NONE ")); break;
case AIS_REST: mprintf((0, "REST ")); break;
case AIS_SRCH: mprintf((0, "SRCH ")); break;
case AIS_LOCK: mprintf((0, "LOCK ")); break;
case AIS_FLIN: mprintf((0, "FLIN ")); break;
case AIS_FIRE: mprintf((0, "FIRE ")); break;
case AIS_RECO: mprintf((0, "RECO ")); break;
case AIS_ERR_: mprintf((0, "ERR_ ")); break;
}
mprintf((0, " Cur = "));
switch (aip->CURRENT_STATE) {
case AIS_NONE: mprintf((0, "NONE ")); break;
case AIS_REST: mprintf((0, "REST ")); break;
case AIS_SRCH: mprintf((0, "SRCH ")); break;
case AIS_LOCK: mprintf((0, "LOCK ")); break;
case AIS_FLIN: mprintf((0, "FLIN ")); break;
case AIS_FIRE: mprintf((0, "FIRE ")); break;
case AIS_RECO: mprintf((0, "RECO ")); break;
case AIS_ERR_: mprintf((0, "ERR_ ")); break;
}
mprintf((0, " Aware = "));
switch (ailp->player_awareness_type) {
case AIE_FIRE: mprintf((0, "FIRE ")); break;
case AIE_HITT: mprintf((0, "HITT ")); break;
case AIE_COLL: mprintf((0, "COLL ")); break;
case AIE_HURT: mprintf((0, "HURT ")); break;
}
mprintf((0, "Next fire = %6.3f, Time = %6.3f\n", f2fl(ailp->next_fire), f2fl(ailp->player_awareness_time)));
}
#endif
// -------------------------------------------------------------------------------------------------------------------
int Break_on_object = -1;
@ -1527,13 +1428,11 @@ void do_ai_robot_hit(object *objp, int type)
r = d_rand();
// 1/8 time, charge player, 1/4 time create path, rest of time, do nothing
if (r < 4096) {
// -- mprintf((0, "Still guy switching to Station, creating path to player."));
create_path_to_player(objp, 10, 1);
objp->ctype.ai_info.behavior = AIB_STATION;
objp->ctype.ai_info.hide_segment = objp->segnum;
Ai_local_info[objp-Objects].mode = AIM_CHASE_OBJECT;
} else if (r < 4096+8192) {
// -- mprintf((0, "Still guy creating n segment path."));
create_n_segment_path(objp, d_rand()/8192 + 2, -1);
Ai_local_info[objp-Objects].mode = AIM_FOLLOW_PATH;
}
@ -1584,7 +1483,6 @@ void compute_vis_and_vec(object *objp, vms_vector *pos, ai_local *ailp, vms_vect
// *player_visibility = 2;
if ((ailp->next_misc_sound_time < GameTime) && ((ailp->next_fire < F1_0) || (ailp->next_fire2 < F1_0)) && (dist < F1_0*20)) {
// mprintf((0, "ANGRY! "));
ailp->next_misc_sound_time = GameTime + (d_rand() + F1_0) * (7 - Difficulty_level) / 1;
digi_link_sound_to_pos( robptr->see_sound, objp->segnum, 0, pos, 0 , Robot_sound_volume);
}
@ -1592,7 +1490,6 @@ void compute_vis_and_vec(object *objp, vms_vector *pos, ai_local *ailp, vms_vect
// Compute expensive stuff -- vec_to_player and player_visibility
vm_vec_normalized_dir_quick(vec_to_player, &Believed_player_pos, pos);
if ((vec_to_player->x == 0) && (vec_to_player->y == 0) && (vec_to_player->z == 0)) {
// -- mprintf((0, "Warning: Player and robot at exactly the same location.\n"));
vec_to_player->x = F1_0;
}
*player_visibility = player_is_visible_from_object(objp, pos, robptr->field_of_view[Difficulty_level], vec_to_player);
@ -1611,31 +1508,19 @@ void compute_vis_and_vec(object *objp, vms_vector *pos, ai_local *ailp, vms_vect
if ((ailp->previous_visibility != *player_visibility) && (*player_visibility == 2)) {
if (ailp->previous_visibility == 0) {
if (ailp->time_player_seen + F1_0/2 < GameTime) {
// -- mprintf((0, "SEE! "));
// -- if (Player_exploded)
// -- digi_link_sound_to_pos( robptr->taunt_sound, objp->segnum, 0, pos, 0 , Robot_sound_volume);
// -- else
digi_link_sound_to_pos( robptr->see_sound, objp->segnum, 0, pos, 0 , Robot_sound_volume);
digi_link_sound_to_pos( robptr->see_sound, objp->segnum, 0, pos, 0 , Robot_sound_volume);
ailp->time_player_sound_attacked = GameTime;
ailp->next_misc_sound_time = GameTime + F1_0 + d_rand()*4;
}
} else if (ailp->time_player_sound_attacked + F1_0/4 < GameTime) {
// -- mprintf((0, "ANGRY! "));
// -- if (Player_exploded)
// -- digi_link_sound_to_pos( robptr->taunt_sound, objp->segnum, 0, pos, 0 , Robot_sound_volume);
// -- else
digi_link_sound_to_pos( robptr->attack_sound, objp->segnum, 0, pos, 0 , Robot_sound_volume);
digi_link_sound_to_pos( robptr->attack_sound, objp->segnum, 0, pos, 0 , Robot_sound_volume);
ailp->time_player_sound_attacked = GameTime;
}
}
if ((*player_visibility == 2) && (ailp->next_misc_sound_time < GameTime)) {
// -- mprintf((0, "ATTACK! "));
ailp->next_misc_sound_time = GameTime + (d_rand() + F1_0) * (7 - Difficulty_level) / 2;
// -- if (Player_exploded)
// -- digi_link_sound_to_pos( robptr->taunt_sound, objp->segnum, 0, pos, 0 , Robot_sound_volume);
// -- else
digi_link_sound_to_pos( robptr->attack_sound, objp->segnum, 0, pos, 0 , Robot_sound_volume);
digi_link_sound_to_pos( robptr->attack_sound, objp->segnum, 0, pos, 0 , Robot_sound_volume);
}
ailp->previous_visibility = *player_visibility;
}
@ -1690,7 +1575,6 @@ void move_object_to_legal_spot(object *objp)
Int3(); // Note: Boss is poking outside mine. Will try to resolve.
teleport_boss(objp);
} else {
mprintf((0, "Note: Killing robot #%i because he's badly stuck outside the mine.\n", objp-Objects));
apply_damage_to_robot(objp, objp->shields*2, objp-Objects);
}
}
@ -1712,9 +1596,7 @@ void move_towards_segment_center(object *objp)
if (dist_to_center < objp->size) {
// Center is nearer than the distance we want to move, so move to center.
objp->pos = segment_center;
mprintf((0, "Object #%i moved to center of segment #%i (%7.3f %7.3f %7.3f)\n", objp-Objects, objp->segnum, f2fl(objp->pos.x), f2fl(objp->pos.y), f2fl(objp->pos.z)));
if (object_intersects_wall(objp)) {
mprintf((0, "Object #%i still illegal, trying trickier move.\n"));
move_object_to_legal_spot(objp);
}
} else {
@ -1727,7 +1609,6 @@ void move_towards_segment_center(object *objp)
objp->pos = segment_center;
move_object_to_legal_spot(objp);
}
// -- mprintf((0, "Obj %i moved twrds seg %i (%6.2f %6.2f %6.2f), dists: [%6.2f %6.2f]\n", objp-Objects, objp->segnum, f2fl(objp->pos.x), f2fl(objp->pos.y), f2fl(objp->pos.z), f2fl(vm_vec_dist_quick(&objp->pos, &segment_center)), f2fl(vm_vec_dist_quick(&objp->pos, &segment_center))));
}
}
@ -1874,42 +1755,6 @@ int openable_doors_in_segment(int segnum)
}
// -- // --------------------------------------------------------------------------------------------------------------------
// -- // Return true if a special object (player or control center) is in this segment.
// -- int special_object_in_seg(int segnum)
// -- {
// -- int objnum;
// --
// -- objnum = Segments[segnum].objects;
// --
// -- while (objnum != -1) {
// -- if ((Objects[objnum].type == OBJ_PLAYER) || (Objects[objnum].type == OBJ_CNTRLCEN)) {
// -- mprintf((0, "Special object of type %i in segment %i\n", Objects[objnum].type, segnum));
// -- return 1;
// -- } else
// -- objnum = Objects[objnum].next;
// -- }
// --
// -- return 0;
// -- }
// -- // --------------------------------------------------------------------------------------------------------------------
// -- // Randomly select a segment attached to *segp, reachable by flying.
// -- int get_random_child(int segnum)
// -- {
// -- int sidenum;
// -- segment *segp = &Segments[segnum];
// --
// -- sidenum = (rand() * 6) >> 15;
// --
// -- while (!(WALL_IS_DOORWAY(segp, sidenum) & WID_FLY_FLAG))
// -- sidenum = (rand() * 6) >> 15;
// --
// -- segnum = segp->children[sidenum];
// --
// -- return segnum;
// -- }
// --------------------------------------------------------------------------------------------------------------------
// Return true if placing an object of size size at pos *pos intersects a (player or robot or control center) in segment *segp.
int check_object_object_intersection(vms_vector *pos, fix size, segment *segp)
@ -1954,7 +1799,6 @@ int create_gated_robot( int segnum, int object_id, vms_vector *pos)
count++;
if (count > 2*Difficulty_level + 6) {
//mprintf((0, "Cannot gate in a robot until you kill one.\n"));
Last_gate_time = GameTime - 3*Gate_interval/4;
return -1;
}
@ -1967,7 +1811,6 @@ int create_gated_robot( int segnum, int object_id, vms_vector *pos)
// See if legal to place object here. If not, move about in segment and try again.
if (check_object_object_intersection(&object_pos, objsize, segp)) {
//mprintf((0, "Can't get in because object collides with something.\n"));
Last_gate_time = GameTime - 3*Gate_interval/4;
return -1;
}
@ -1975,13 +1818,10 @@ int create_gated_robot( int segnum, int object_id, vms_vector *pos)
objnum = obj_create(OBJ_ROBOT, object_id, segnum, &object_pos, &vmd_identity_matrix, objsize, CT_AI, MT_PHYSICS, RT_POLYOBJ);
if ( objnum < 0 ) {
// mprintf((1, "Can't get object to gate in robot. Not gating in.\n"));
Last_gate_time = GameTime - 3*Gate_interval/4;
return -1;
}
//mprintf((0, "Gating in object %i in segment %i\n", objnum, segp-Segments));
Objects[objnum].lifeleft = F1_0*30; // Gated in robots only live 30 seconds.
#ifdef NETWORK
@ -2049,7 +1889,6 @@ int boss_spew_robot(object *objp, vms_vector *pos)
segnum = find_point_seg(pos, objp->segnum);
if (segnum == -1) {
mprintf((0, "Tried to spew a bot outside the mine! Aborting!\n"));
return -1;
}
@ -2146,8 +1985,6 @@ void teleport_boss(object *objp)
rand_segnum = Boss_teleport_segs[rand_index];
Assert((rand_segnum >= 0) && (rand_segnum <= Highest_segment_index));
//mprintf((0, "Frame %i: Boss teleporting to segment #%i, pos = {%8x %8x %8x}.\n", FrameCount, rand_segnum, objp->pos.x, objp->pos.y, objp->pos.z));
#ifdef NETWORK
if (Game_mode & GM_MULTI)
multi_send_boss_actions(objp-Objects, 1, rand_segnum, 0);
@ -2211,7 +2048,6 @@ int do_robot_dying_frame(object *objp, fix start_time, fix roll_duration, sbyte
if (start_time + roll_duration - sound_duration < GameTime) {
if (!*dying_sound_playing) {
mprintf((0, "Starting death sound!\n"));
*dying_sound_playing = 1;
digi_link_sound_to_object2( death_sound, objp-Objects, 0, sound_scale, sound_scale*256 ); // F1_0*512 means play twice as loud
} else if (d_rand() < FrameTime*16)
@ -2316,7 +2152,6 @@ void do_boss_stuff(object *objp, int player_visibility)
#ifndef NDEBUG
if (objp->shields != Prev_boss_shields) {
mprintf((0, "Boss shields = %7.3f, object %i\n", f2fl(objp->shields), objp-Objects));
Prev_boss_shields = objp->shields;
}
#endif
@ -2475,12 +2310,11 @@ void ai_do_actual_firing_stuff(object *obj, ai_static *aip, ai_local *ailp, robo
return;
do_ai_robot_hit_attack(obj, ConsoleObject, &obj->pos);
} else {
// mprintf((0, "Green won't fire: Too far: dist = %7.3f, threshold = %7.3f\n", f2fl(dist_to_player), f2fl(obj->size + ConsoleObject->size + F1_0*2)));
return;
}
} else {
if ((gun_point->x == 0) && (gun_point->y == 0) && (gun_point->z == 0)) {
; //mprintf((0, "Would like to fire gun, but gun not selected.\n"));
;
} else {
if (!ai_multiplayer_awareness(obj, ROBOT_FIRE_AGITATION))
return;
@ -2570,12 +2404,11 @@ void ai_do_actual_firing_stuff(object *obj, ai_static *aip, ai_local *ailp, robo
return;
do_ai_robot_hit_attack(obj, ConsoleObject, &obj->pos);
} else {
// mprintf((0, "Green won't fire: Too far: dist = %7.3f, threshold = %7.3f\n", f2fl(dist_to_player), f2fl(obj->size + ConsoleObject->size + F1_0*2)));
return;
}
} else {
if ((gun_point->x == 0) && (gun_point->y == 0) && (gun_point->z == 0)) {
; //mprintf((0, "Would like to fire gun, but gun not selected.\n"));
;
} else {
if (!ai_multiplayer_awareness(obj, ROBOT_FIRE_AGITATION))
return;

View File

@ -1,4 +1,3 @@
/* $Id: aipath.c,v 1.1.1.1 2006/03/17 19:55:43 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -27,7 +26,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include <string.h> // for memset()
#include "inferno.h"
#include "mono.h"
#include "console.h"
#include "3d.h"
#include "object.h"
@ -111,7 +110,6 @@ void insert_center_points(point_seg *psegs, int *num_points)
vm_vec_sub(&psegs[2*i-1].point, &center_point, &new_point);
temp_segnum = find_point_seg(&psegs[2*i-1].point, psegs[2*i].segnum);
if (temp_segnum == -1) {
mprintf((1, "Warning: point not in ANY segment in aipath.c/insert_center_points.\n"));
psegs[2*i-1].point = center_point;
find_point_seg(&psegs[2*i-1].point, psegs[2*i].segnum);
}
@ -212,8 +210,6 @@ void move_towards_outside(point_seg *psegs, int *num_points, object *objp, int r
if (vm_vec_mag_quick(&e) < F1_0/2)
Int3();
//mprintf((0, "(%i) Moving to side: %6.3f %6.3f %6.3f\n", i, f2fl(e.x), f2fl(e.y), f2fl(e.z)));
segment_size = vm_vec_dist_quick(&Vertices[Segments[segnum].verts[0]], &Vertices[Segments[segnum].verts[6]]);
if (segment_size > F1_0*40)
segment_size = F1_0*40;
@ -294,7 +290,6 @@ int create_path_points(object *objp, int start_seg, int end_seg, point_seg *pseg
point_seg *original_psegs = psegs;
int l_num_points;
// -- mprintf((0, "cpp: frame = %4i obj %3i, psegs = %5i\n", FrameCount, objp-Objects, psegs-Point_segs));
#if PATH_VALIDATION
validate_all_paths();
#endif
@ -325,8 +320,7 @@ if ((objp->type == OBJ_ROBOT) && (objp->ctype.ai_info.behavior == AIB_RUN_FROM))
if ((start_seg != avoid_seg) && (end_seg != avoid_seg)) {
visited[avoid_seg] = 1;
depth[avoid_seg] = 0;
} else
; // -- mprintf((0, "Start/End/Avoid = %i %i %i\n", start_seg, end_seg, avoid_seg));
}
}
if (random_flag)
@ -343,7 +337,6 @@ if ((objp->type == OBJ_ROBOT) && (objp->ctype.ai_info.behavior == AIB_RUN_FROM))
if (d_rand() < 8192)
create_random_xlate(random_xlate);
// mprintf((0, "\n"));
for (sidenum = 0; sidenum < MAX_SIDES_PER_SEGMENT; sidenum++) {
int snum = sidenum;
@ -373,7 +366,6 @@ if ((objp->type == OBJ_ROBOT) && (objp->ctype.ai_info.behavior == AIB_RUN_FROM))
hit_type = find_vector_intersection(&fq, &hit_data);
if (hit_type != HIT_NONE) {
// -- mprintf((0, "hit_type = %i, object = %i\n", hit_type, hit_data.hit_object));
goto dont_add;
}
}
@ -384,7 +376,6 @@ if ((objp->type == OBJ_ROBOT) && (objp->ctype.ai_info.behavior == AIB_RUN_FROM))
visited[this_seg] = 1;
depth[qtail++] = cur_depth+1;
if (depth[qtail-1] == max_depth) {
// mprintf((0, "\ndepth == max_depth == %i\n", max_depth));
end_seg = seg_queue[qtail-1].end;
goto cpp_done1;
} // end if (depth[...
@ -414,9 +405,6 @@ cpp_done1: ;
// Set qtail to the segment which ends at the goal.
while (seg_queue[--qtail].end != end_seg)
if (qtail < 0) {
// mprintf((0, "\nNo path!\n"));
// printf("UNABLE TO FORM PATH");
// Int3();
*num_points = l_num_points;
return -1;
}
@ -427,7 +415,7 @@ cpp_done1: ;
#ifdef EDITOR
// -- N_selected_segs = 0;
#endif
//printf("Object #%3i, start: %3i ", objp-Objects, psegs-Point_segs);
while (qtail >= 0) {
int parent_seg, this_seg;
@ -435,7 +423,6 @@ cpp_done1: ;
parent_seg = seg_queue[qtail].start;
Assert((this_seg >= 0) && (this_seg <= Highest_segment_index));
psegs->segnum = this_seg;
//printf("%3i ", this_seg);
compute_segment_center(&psegs->point,&Segments[this_seg]);
psegs++;
l_num_points++;
@ -452,7 +439,6 @@ cpp_done1: ;
Assert((start_seg >= 0) && (start_seg <= Highest_segment_index));
psegs->segnum = start_seg;
//printf("%3i\n", start_seg);
compute_segment_center(&psegs->point,&Segments[start_seg]);
psegs++;
l_num_points++;
@ -477,16 +463,12 @@ cpp_done1: ;
if (safety_flag) {
if (psegs - Point_segs + l_num_points + 2 > MAX_POINT_SEGS) {
// Ouch! Cannot insert center points in path. So return unsafe path.
// Int3(); // Contact Mike: This is impossible.
// force_dump_ai_objects_all("Error in create_path_points");
mprintf((0, "Resetting all paths because of safety_flag.\n"));
ai_reset_all_paths();
*num_points = l_num_points;
return -1;
} else {
// int old_num_points = l_num_points;
insert_center_points(original_psegs, &l_num_points);
// mprintf((0, "Saved %i/%i points.\n", 2*old_num_points - l_num_points - 1, old_num_points-1));
}
}
@ -580,29 +562,22 @@ int validate_path(int debug_flag, point_seg *psegs, int num_points)
curseg = psegs->segnum;
if ((curseg < 0) || (curseg > Highest_segment_index)) {
mprintf((0, "Path beginning at index %i, length=%i is bogus!\n", psegs-Point_segs, num_points));
Int3(); // Contact Mike: Debug trap for elusive, nasty bug.
return 0;
}
if (debug_flag == 999)
mprintf((0, "That's curious...\n"));
if (num_points == 0)
return 1;
// printf("(%i) Validating path at psegs=%i, num_points=%i, segments = %3i ", debug_flag, psegs-Point_segs, num_points, psegs[0].segnum);
for (i=1; i<num_points; i++) {
int sidenum;
int nextseg = psegs[i].segnum;
if ((nextseg < 0) || (nextseg > Highest_segment_index)) {
mprintf((0, "Path beginning at index %i, length=%i is bogus!\n", psegs-Point_segs, num_points));
Int3(); // Contact Mike: Debug trap for elusive, nasty bug.
return 0;
}
// printf("%3i ", nextseg);
if (curseg != nextseg) {
for (sidenum=0; sidenum<MAX_SIDES_PER_SEGMENT; sidenum++)
if (Segments[curseg].children[sidenum] == nextseg)
@ -610,15 +585,12 @@ if (num_points == 0)
// Assert(sidenum != MAX_SIDES_PER_SEGMENT); // Hey, created path is not contiguous, why!?
if (sidenum == MAX_SIDES_PER_SEGMENT) {
mprintf((0, "Path beginning at index %i, length=%i is bogus!\n", psegs-Point_segs, num_points));
// printf("BOGUS");
Int3();
return 0;
}
curseg = nextseg;
}
}
//printf("\n");
#endif
return 1;
@ -655,47 +627,6 @@ void validate_all_paths(void)
}
#endif
// -- // -------------------------------------------------------------------------------------------------------
// -- // Creates a path from the objects current segment (objp->segnum) to the specified segment for the object to
// -- // hide in Ai_local_info[objnum].goal_segment.
// -- // Sets objp->ctype.ai_info.hide_index, a pointer into Point_segs, the first point_seg of the path.
// -- // objp->ctype.ai_info.path_length, length of path
// -- // Point_segs_free_ptr global pointer into Point_segs array
// -- void create_path(object *objp)
// -- {
// -- ai_static *aip = &objp->ctype.ai_info;
// -- ai_local *ailp = &Ai_local_info[objp-Objects];
// -- int start_seg, end_seg;
// --
// -- start_seg = objp->segnum;
// -- end_seg = ailp->goal_segment;
// --
// -- if (end_seg == -1)
// -- create_n_segment_path(objp, 3, -1);
// --
// -- if (end_seg == -1) {
// -- ; //mprintf((0, "Object %i, hide_segment = -1, not creating path.\n", objp-Objects));
// -- } else {
// -- create_path_points(objp, start_seg, end_seg, Point_segs_free_ptr, &aip->path_length, -1, 0, 0, -1);
// -- aip->hide_index = Point_segs_free_ptr - Point_segs;
// -- aip->cur_path_index = 0;
// -- #if PATH_VALIDATION
// -- validate_path(5, Point_segs_free_ptr, aip->path_length);
// -- #endif
// -- Point_segs_free_ptr += aip->path_length;
// -- if (Point_segs_free_ptr - Point_segs + MAX_PATH_LENGTH*2 > MAX_POINT_SEGS) {
// -- //Int3(); // Contact Mike: This is curious, though not deadly. /eip++;g
// -- //force_dump_ai_objects_all("Error in create_path");
// -- ai_reset_all_paths();
// -- }
// -- aip->PATH_DIR = 1; // Initialize to moving forward.
// -- aip->SUBMODE = AISM_HIDING; // Pretend we are hiding, so we sit here until bothered.
// -- }
// --
// -- maybe_ai_path_garbage_collect();
// --
// -- }
// -------------------------------------------------------------------------------------------------------
// Creates a path from the objects current segment (objp->segnum) to the specified segment for the object to
// hide in Ai_local_info[objnum].goal_segment.
@ -709,7 +640,6 @@ void create_path_to_player(object *objp, int max_length, int safety_flag)
ai_local *ailp = &Ai_local_info[objp-Objects];
int start_seg, end_seg;
//mprintf((0, "Creating path to player.\n"));
if (max_length == -1)
max_length = MAX_DEPTH_TO_SEARCH_FOR_PLAYER;
@ -719,10 +649,8 @@ void create_path_to_player(object *objp, int max_length, int safety_flag)
start_seg = objp->segnum;
end_seg = ailp->goal_segment;
// mprintf((0, "Creating path for object #%i, from segment #%i to #%i\n", objp-Objects, start_seg, end_seg));
if (end_seg == -1) {
; //mprintf((0, "Object %i, hide_segment = -1, not creating path.\n", objp-Objects));
;
} else {
create_path_points(objp, start_seg, end_seg, Point_segs_free_ptr, &aip->path_length, max_length, 1, safety_flag, -1);
aip->path_length = polish_path(objp, Point_segs_free_ptr, aip->path_length);
@ -740,7 +668,6 @@ void create_path_to_player(object *objp, int max_length, int safety_flag)
// -- UNUSED! aip->SUBMODE = AISM_GOHIDE; // This forces immediate movement.
ailp->mode = AIM_FOLLOW_PATH;
ailp->player_awareness_type = 0; // If robot too aware of player, will set mode to chase
// mprintf((0, "Created %i segment path to player.\n", aip->path_length));
}
maybe_ai_path_garbage_collect();
@ -805,10 +732,8 @@ void create_path_to_station(object *objp, int max_length)
start_seg = objp->segnum;
end_seg = aip->hide_segment;
//1001: mprintf((0, "Back to station for object #%i, from segment #%i to #%i\n", objp-Objects, start_seg, end_seg));
if (end_seg == -1) {
; //mprintf((0, "Object %i, hide_segment = -1, not creating path.\n", objp-Objects));
;
} else {
create_path_points(objp, start_seg, end_seg, Point_segs_free_ptr, &aip->path_length, max_length, 1, 1, -1);
aip->path_length = polish_path(objp, Point_segs_free_ptr, aip->path_length);
@ -842,12 +767,9 @@ void create_n_segment_path(object *objp, int path_length, int avoid_seg)
ai_static *aip=&objp->ctype.ai_info;
ai_local *ailp = &Ai_local_info[objp-Objects];
//mprintf((0, "Creating %i segment path.\n", path_length));
if (create_path_points(objp, objp->segnum, -2, Point_segs_free_ptr, &aip->path_length, path_length, 1, 0, avoid_seg) == -1) {
Point_segs_free_ptr += aip->path_length;
while ((create_path_points(objp, objp->segnum, -2, Point_segs_free_ptr, &aip->path_length, --path_length, 1, 0, -1) == -1)) {
//mprintf((0, "R"));
Assert(path_length);
}
}
@ -877,7 +799,6 @@ void create_n_segment_path(object *objp, int path_length, int avoid_seg)
aip->path_length = t_num_points;
}
}
//mprintf((0, "\n"));
maybe_ai_path_garbage_collect();
@ -904,8 +825,6 @@ void move_object_to_goal(object *objp, vms_vector *goal_point, int goal_seg)
Assert(objp->segnum != -1);
// mprintf((0, "[%i -> %i]\n", objp-Objects, goal_seg));
#ifndef NDEBUG
if (objp->segnum != goal_seg)
if (find_connect_side(&Segments[objp->segnum], &Segments[goal_seg]) == -1) {
@ -913,7 +832,6 @@ void move_object_to_goal(object *objp, vms_vector *goal_point, int goal_seg)
dist = find_connected_distance(&objp->pos, objp->segnum, goal_point, goal_seg, 30, WID_FLY_FLAG);
if (Connected_segment_distance > 2) { // This global is set in find_connected_distance
// -- Int3();
mprintf((1, "Warning: Object %i hopped across %i segments, a distance of %7.3f.\n", objp-Objects, Connected_segment_distance, f2fl(dist)));
}
}
#endif
@ -922,7 +840,6 @@ void move_object_to_goal(object *objp, vms_vector *goal_point, int goal_seg)
if (aip->cur_path_index <= 0) {
if (aip->behavior == AIB_STATION) {
// mprintf((0, "Object #%i, creating path back to station.\n", objp-Objects));
create_path_to_station(objp, 15);
return;
}
@ -930,7 +847,6 @@ void move_object_to_goal(object *objp, vms_vector *goal_point, int goal_seg)
aip->PATH_DIR = 1;
} else if (aip->cur_path_index >= aip->path_length - 1) {
if (aip->behavior == AIB_STATION) {
// mprintf((0, "Object #%i, creating path back to station.\n", objp-Objects));
create_path_to_station(objp, 15);
if (aip->path_length == 0) {
ai_local *ailp = &Ai_local_info[objp-Objects];
@ -948,8 +864,6 @@ void move_object_to_goal(object *objp, vms_vector *goal_point, int goal_seg)
objp->pos = *goal_point;
segnum = find_object_seg(objp);
if (segnum != goal_seg)
mprintf((1, "Object #%i goal supposed to be in segment #%i, but in segment #%i\n", objp-Objects, goal_seg, segnum));
if (segnum == -1) {
Int3(); // Oops, object is not in any segment.
@ -1006,8 +920,6 @@ void ai_follow_path(object *objp, int player_visibility, int previous_visibility
fix threshold_distance;
// mprintf((0, "Obj %i, dist=%6.1f index=%i len=%i seg=%i pos = %6.1f %6.1f %6.1f.\n", objp-Objects, f2fl(vm_vec_dist_quick(&objp->pos, &ConsoleObject->pos)), aip->cur_path_index, aip->path_length, objp->segnum, f2fl(objp->pos.x), f2fl(objp->pos.y), f2
if ((aip->hide_index == -1) || (aip->path_length == 0))
{
if (ailp->mode == AIM_RUN_FROM_OBJECT) {
@ -1015,7 +927,6 @@ void ai_follow_path(object *objp, int player_visibility, int previous_visibility
//--Int3_if((aip->path_length != 0));
ailp->mode = AIM_RUN_FROM_OBJECT;
} else {
// -- mprintf((0, "Object %i creating path for no apparent reason.\n", objp-Objects));
create_n_segment_path(objp, 5, -1);
//--Int3_if((aip->path_length != 0));
}
@ -1168,14 +1079,6 @@ void ai_follow_path(object *objp, int player_visibility, int previous_visibility
// See if next point wraps past end of path (in either direction), and if so, deal with it based on mode.
if ((aip->cur_path_index >= aip->path_length) || (aip->cur_path_index < 0)) {
//mprintf((0, "Object %i reached end of the line!\n", objp-Objects));
// If mode = hiding, then stay here until get bonked or hit by player.
// -- if (ailp->mode == AIM_BEHIND) {
// -- ailp->mode = AIM_STILL;
// -- return; // Stay here until bonked or hit by player.
// -- } else
// Buddy bot. If he's in mode to get away from player and at end of line,
// if player visible, then make a new path, else just return.
if (robptr->companion) {
@ -1185,7 +1088,6 @@ void ai_follow_path(object *objp, int player_visibility, int previous_visibility
create_n_segment_path(objp, 16 + d_rand() * 16, -1);
aip->path_length = polish_path(objp, &Point_segs[aip->hide_index], aip->path_length);
Assert(aip->path_length != 0);
// -- mprintf((0, "Buddy: Creating new path!\n"));
ailp->mode = AIM_WANDER; // Special buddy mode.
//--Int3_if(((aip->cur_path_index >= 0) && (aip->cur_path_index < aip->path_length)));
return;
@ -1193,7 +1095,6 @@ void ai_follow_path(object *objp, int player_visibility, int previous_visibility
ailp->mode = AIM_WANDER; // Special buddy mode.
vm_vec_zero(&objp->mtype.phys_info.velocity);
vm_vec_zero(&objp->mtype.phys_info.rotvel);
// -- mprintf((0, "Buddy: I'm hidden!\n"));
//!!Assert((aip->cur_path_index >= 0) && (aip->cur_path_index < aip->path_length));
return;
}
@ -1201,11 +1102,9 @@ void ai_follow_path(object *objp, int player_visibility, int previous_visibility
}
if (aip->behavior == AIB_FOLLOW) {
// mprintf((0, "AIB_FOLLOW: Making new path.\n"));
create_n_segment_path(objp, 10, ConsoleObject->segnum);
//--Int3_if(((aip->cur_path_index >= 0) && (aip->cur_path_index < aip->path_length)));
} else if (aip->behavior == AIB_STATION) {
// mprintf((0, "Object %i reached end of line, creating path back to station.\n", objp-Objects));
create_path_to_station(objp, 15);
if ((aip->hide_segment != Point_segs[aip->hide_index+aip->path_length-1].segnum) || (aip->path_length == 0)) {
ailp->mode = AIM_STILL;
@ -1346,7 +1245,6 @@ void ai_path_set_orient_and_vel(object *objp, vms_vector *goal_point, int player
// If very close to facing opposite desired vector, perturb vector
if (dot < -15*F1_0/16) {
//mprintf((0, "Facing away from goal, abruptly turning\n"));
norm_cur_vel = norm_vec_to_goal;
} else {
norm_cur_vel.x += norm_vec_to_goal.x/2;
@ -1402,8 +1300,6 @@ void ai_path_garbage_collect(void)
force_dump_ai_objects_all("***** Start ai_path_garbage_collect *****");
#endif
// -- mprintf((0, "Garbage collection frame %i, last frame %i! Old free index = %i ", FrameCount, Last_frame_garbage_collected, Point_segs_free_ptr - Point_segs));
Last_frame_garbage_collected = FrameCount;
#if PATH_VALIDATION
@ -1444,8 +1340,6 @@ void ai_path_garbage_collect(void)
Point_segs_free_ptr = &Point_segs[free_path_index];
// mprintf((0, "new = %i\n", free_path_index));
//printf("After garbage collection, free index = %i\n", Point_segs_free_ptr - Point_segs);
#ifndef NDEBUG
{
int i;
@ -1475,12 +1369,9 @@ void maybe_ai_path_garbage_collect(void)
// This is kind of bad. Garbage collected last frame or this frame.
// Just destroy all paths. Too bad for the robots. They are memory wasteful.
ai_reset_all_paths();
mprintf((1, "Warning: Resetting all paths. Point_segs buffer nearly exhausted.\n"));
} else {
// We are really close to full, but didn't just garbage collect, so maybe this is recoverable.
mprintf((1, "Warning: Almost full garbage collection being performed: "));
ai_path_garbage_collect();
mprintf((1, "Free records = %i/%i\n", MAX_POINT_SEGS - (Point_segs_free_ptr - Point_segs), MAX_POINT_SEGS));
}
} else if (Point_segs_free_ptr - Point_segs > 3*MAX_POINT_SEGS/4) {
if (Last_frame_garbage_collected + 16 < FrameCount) {
@ -1520,8 +1411,6 @@ void attempt_to_resume_path(object *objp)
// int goal_segnum, object_segnum,
int abs_index, new_path_index;
// mprintf((0, "Object %i trying to resume path at index %i\n", objp-Objects, aip->cur_path_index));
if ((aip->behavior == AIB_STATION) && (Robot_info[objp->id].companion != 1))
if (d_rand() > 8192) {
ai_local *ailp = &Ai_local_info[objp-Objects];
@ -1529,24 +1418,18 @@ void attempt_to_resume_path(object *objp)
aip->hide_segment = objp->segnum;
//Int3();
ailp->mode = AIM_STILL;
mprintf((1, "Note: Bashing hide segment of robot %i to current segment because he's lost.\n", objp-Objects));
}
// object_segnum = objp->segnum;
abs_index = aip->hide_index+aip->cur_path_index;
// goal_segnum = Point_segs[abs_index].segnum;
// if (object_segnum == goal_segnum)
// mprintf((0, "Very peculiar, goal segnum = object's segnum = %i.\n", goal_segnum));
new_path_index = aip->cur_path_index - aip->PATH_DIR;
if ((new_path_index >= 0) && (new_path_index < aip->path_length)) {
// mprintf((0, "Trying path index of %i\n", new_path_index));
aip->cur_path_index = new_path_index;
} else {
// At end of line and have nowhere to go.
// mprintf((0, "At end of line and can't get to goal. Creating new path. Frame %i\n", FrameCount));
move_towards_segment_center(objp);
create_path_to_station(objp, 15);
}
@ -1584,16 +1467,6 @@ void test_create_path(void)
}
void show_path(int start_seg, int end_seg, point_seg *psp, short length)
{
printf("[%3i:%3i (%3i):] ", start_seg, end_seg, length);
while (length--)
printf("%3i ", psp[length].segnum);
printf("\n");
}
// For all segments in mine, create paths to all segments in mine, print results.
void test_create_all_paths(void)
{
@ -1603,81 +1476,16 @@ void test_create_all_paths(void)
Point_segs_free_ptr = Point_segs;
for (start_seg=0; start_seg<=Highest_segment_index-1; start_seg++) {
// -- mprintf((0, "."));
if (Segments[start_seg].segnum != -1) {
for (end_seg=start_seg+1; end_seg<=Highest_segment_index; end_seg++) {
if (Segments[end_seg].segnum != -1) {
create_path_points(&Objects[0], start_seg, end_seg, Point_segs_free_ptr, &resultant_length, -1, 0, 0, -1);
show_path(start_seg, end_seg, Point_segs_free_ptr, resultant_length);
}
}
}
}
}
//--anchor--int Num_anchors;
//--anchor--int Anchor_distance = 3;
//--anchor--int End_distance = 1;
//--anchor--int Anchors[MAX_SEGMENTS];
//--anchor--int get_nearest_anchor_distance(int segnum)
//--anchor--{
//--anchor-- short resultant_length, minimum_length;
//--anchor-- int anchor_index;
//--anchor--
//--anchor-- minimum_length = 16383;
//--anchor--
//--anchor-- for (anchor_index=0; anchor_index<Num_anchors; anchor_index++) {
//--anchor-- create_path_points(&Objects[0], segnum, Anchors[anchor_index], Point_segs_free_ptr, &resultant_length, -1, 0, 0, -1);
//--anchor-- if (resultant_length != 0)
//--anchor-- if (resultant_length < minimum_length)
//--anchor-- minimum_length = resultant_length;
//--anchor-- }
//--anchor--
//--anchor-- return minimum_length;
//--anchor--
//--anchor--}
//--anchor--
//--anchor--void create_new_anchor(int segnum)
//--anchor--{
//--anchor-- Anchors[Num_anchors++] = segnum;
//--anchor--}
//--anchor--
//--anchor--// A set of anchors is within N units of all segments in the graph.
//--anchor--// Anchor_distance = how close anchors can be.
//--anchor--// End_distance = how close you can be to the end.
//--anchor--void test_create_all_anchors(void)
//--anchor--{
//--anchor-- int nearest_anchor_distance;
//--anchor-- int segnum,i;
//--anchor--
//--anchor-- Num_anchors = 0;
//--anchor--
//--anchor-- for (segnum=0; segnum<=Highest_segment_index; segnum++) {
//--anchor-- if (Segments[segnum].segnum != -1) {
//--anchor-- nearest_anchor_distance = get_nearest_anchor_distance(segnum);
//--anchor-- if (nearest_anchor_distance > Anchor_distance)
//--anchor-- create_new_anchor(segnum);
//--anchor-- }
//--anchor-- }
//--anchor--
//--anchor-- // Set selected segs.
//--anchor-- for (i=0; i<Num_anchors; i++)
//--anchor-- Selected_segs[i] = Anchors[i];
//--anchor-- N_selected_segs = Num_anchors;
//--anchor--
//--anchor--}
//--anchor--
//--anchor--int Test_path_length = 5;
//--anchor--
//--anchor--void test_create_n_segment_path(void)
//--anchor--{
//--anchor-- point_seg point_segs[200];
//--anchor-- short num_points;
//--anchor--
//--anchor-- create_path_points(&Objects[0], Cursegp-Segments, -2, point_segs, &num_points, Test_path_length, 0, 0, -1);
//--anchor--}
short Player_path_length=0;
int Player_hide_index=-1;
int Player_cur_path_index=0;
@ -1714,7 +1522,6 @@ void player_path_set_orient_and_vel(object *objp, vms_vector *goal_point)
// If very close to facing opposite desired vector, perturb vector
if (dot < -15*F1_0/16) {
//mprintf((0, "Facing away from goal, abruptly turning\n"));
norm_cur_vel = norm_vec_to_goal;
} else {
norm_cur_vel.x += norm_vec_to_goal.x/2;
@ -1780,12 +1587,8 @@ void player_follow_path(object *objp)
while ((dist_to_goal < threshold_distance) && !forced_break) {
// -- if (count > 1)
// -- mprintf((0, "."));
// ----- Debug stuff -----
if (count++ > 20) {
mprintf((1,"Problem following path for player. Aborting.\n"));
break;
}
@ -1800,7 +1603,6 @@ void player_follow_path(object *objp)
// If went all the way around to original point, in same direction, then get out of here!
if (Player_cur_path_index == original_index) {
mprintf((0, "Forcing break because player path wrapped, count = %i.\n", count));
Player_following_path_flag = 0;
forced_break = 1;
}
@ -1828,7 +1630,7 @@ void create_player_path_to_segment(int segnum)
Player_following_path_flag=0;
if (create_path_points(objp, objp->segnum, segnum, Point_segs_free_ptr, &Player_path_length, 100, 0, 0, -1) == -1)
mprintf((0, "Unable to form path of length %i for myself\n", 100));
con_printf(CON_DEBUG,"Unable to form path of length %i for myself\n", 100);
Player_following_path_flag = 1;
@ -1841,7 +1643,6 @@ void create_player_path_to_segment(int segnum)
}
}
int Player_goal_segment = -1;
void check_create_player_path(void)

View File

@ -1,4 +1,3 @@
/* $Id: automap.c,v 1.1.1.1 2006/03/17 19:56:52 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -38,7 +37,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "object.h"
#include "vclip.h"
#include "game.h"
#include "mono.h"
#include "polyobj.h"
#include "sounds.h"
#include "player.h"
@ -572,9 +570,6 @@ void do_automap( int key_code ) {
Max_edges = min(MAX_EDGES_FROM_VERTS(Num_vertices),MAX_EDGES); //make maybe smaller than max
mprintf( (0, "Num_vertices=%d, Max_edges=%d, (MAX:%d)\n", Num_vertices, Max_edges, MAX_EDGES ));
mprintf( (0, "Allocated %d K for automap edge list\n", (sizeof(Edge_info)+sizeof(short))*Max_edges/1024 ));
gr_set_current_canvas(NULL);
automap_build_edge_list();
@ -807,7 +802,6 @@ void do_automap( int key_code ) {
#ifdef OGL
gr_free_bitmap_data(&Automap_background);
mprintf( (0, "Automap background memory freed\n" ));
#endif
game_flush_inputs();
@ -826,8 +820,6 @@ void adjust_segment_limit(int SegmentLimit)
int i,e1;
Edge_info * e;
mprintf(( 0, "Seglimit: %d\n", SegmentLimit ));
for (i=0; i<=Highest_edge_index; i++ ) {
e = &Edges[i];
e->flags |= EF_TOO_FAR;
@ -1135,15 +1127,12 @@ void add_segment_edges(segment *seg)
if (Walls[seg->sides[sn].wall_num].keys == KEY_BLUE) {
no_fade = 1;
color = Wall_door_blue;
//mprintf((0, "Seg %i, side %i has BLUE wall\n", segnum, sn));
} else if (Walls[seg->sides[sn].wall_num].keys == KEY_GOLD) {
no_fade = 1;
color = Wall_door_gold;
//mprintf((0, "Seg %i, side %i has GOLD wall\n", segnum, sn));
} else if (Walls[seg->sides[sn].wall_num].keys == KEY_RED) {
no_fade = 1;
color = Wall_door_red;
//mprintf((0, "Seg %i, side %i has RED wall\n", segnum, sn));
} else if (!(WallAnims[Walls[seg->sides[sn].wall_num].clip_num].flags & WCF_HIDDEN)) {
int connected_seg = seg->children[sn];
if (connected_seg != -1) {
@ -1299,7 +1288,6 @@ void automap_build_edge_list()
break;
}
}
mprintf( (0, "Automap used %d / %d edges\n", Num_edges, Max_edges ));
}
char Marker_input [40];

View File

@ -1,4 +1,3 @@
/* $Id: bm.c,v 1.1.1.1 2006/03/17 19:54:47 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -31,7 +30,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "gr.h"
#include "bm.h"
#include "u_mem.h"
#include "mono.h"
#include "error.h"
#include "object.h"
#include "vclip.h"
@ -57,6 +55,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "cntrlcen.h"
#include "makesig.h"
#include "interp.h"
#include "console.h"
ubyte Sounds[MAX_SOUNDS];
ubyte AltSounds[MAX_SOUNDS];
@ -92,9 +91,6 @@ int N_ObjBitmaps;
bitmap_index ObjBitmaps[MAX_OBJ_BITMAPS];
ushort ObjBitmapPtrs[MAX_OBJ_BITMAPS]; // These point back into ObjBitmaps, since some are used twice.
#ifdef FAST_FILE_IO
#define tmap_info_read_n(ti, n, fp) cfread(ti, TMAP_INFO_SIZE, n, fp)
#else
/*
* reads n tmap_info structs from a CFILE
*/
@ -116,7 +112,6 @@ int tmap_info_read_n(tmap_info *ti, int n, CFILE *fp)
}
return i;
}
#endif
int tmap_info_read_n_d1(tmap_info *ti, int n, CFILE *fp)
{

View File

@ -35,7 +35,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "bm.h"
#include "gamepal.h"
#include "u_mem.h"
#include "mono.h"
#include "error.h"
#include "object.h"
#include "vclip.h"
@ -199,7 +198,6 @@ bitmap_index bm_load_sub(int skip, char * filename )
bitmap_num.index = 0;
if (skip) {
//mprintf( 0, "Skipping registered-only bitmap '%s'\n", filename );
return bitmap_num;
}
@ -207,7 +205,6 @@ bitmap_index bm_load_sub(int skip, char * filename )
bitmap_num=piggy_find_bitmap( fname );
if (bitmap_num.index) {
//mprintf(( 0, "Found bitmap '%s' in pig!\n", fname ));
return bitmap_num;
}
@ -215,7 +212,6 @@ bitmap_index bm_load_sub(int skip, char * filename )
iff_error = iff_read_bitmap(filename,new,BM_LINEAR,newpal);
new->bm_handle=0;
if (iff_error != IFF_NO_ERROR) {
mprintf((1, "File %s - IFF error: %s",filename,iff_errormsg(iff_error)));
Error("File <%s> - IFF error: %s, line %d",filename,iff_errormsg(iff_error),linenum);
}
@ -226,7 +222,6 @@ bitmap_index bm_load_sub(int skip, char * filename )
new->avg_color = compute_average_pixel(new);
// -- mprintf((0, "N" ));
bitmap_num = piggy_register_bitmap( new, fname, 0 );
d_free( new );
return bitmap_num;
@ -247,7 +242,6 @@ void ab_load(int skip, char * filename, bitmap_index bmp[], int *nframes )
if (skip) {
Assert( bogus_bitmap_initialized != 0 );
mprintf(( 0, "Skipping registered-only animation '%s'\n", filename ));
bmp[0].index = 0; //index of bogus bitmap==0 (I think) //&bogus_bitmap;
*nframes = 1;
return;
@ -262,7 +256,6 @@ void ab_load(int skip, char * filename, bitmap_index bmp[], int *nframes )
if ( !bi.index )
break;
bmp[i] = bi;
//mprintf(( 0, "Found animation frame %d, %s, in piggy file\n", i, tempname ));
}
if (i) {
@ -276,7 +269,6 @@ void ab_load(int skip, char * filename, bitmap_index bmp[], int *nframes )
// iff_error = iff_read_animbrush(filename,bm,MAX_BITMAPS_PER_BRUSH,nframes,&newpal);
iff_error = iff_read_animbrush(filename,bm,MAX_BITMAPS_PER_BRUSH,nframes,newpal);
if (iff_error != IFF_NO_ERROR) {
mprintf((1,"File %s - IFF error: %s",filename,iff_errormsg(iff_error)));
Error("File <%s> - IFF error: %s, line %d",filename,iff_errormsg(iff_error),linenum);
}
@ -293,12 +285,7 @@ void ab_load(int skip, char * filename, bitmap_index bmp[], int *nframes )
new_bmp = piggy_register_bitmap( bm[i], tempname, 0 );
d_free( bm[i] );
bmp[i] = new_bmp;
if (!i)
mprintf((0, "Registering %s in piggy file.", tempname ));
else
mprintf((0, "."));
}
mprintf((0, "\n"));
}
int ds_load(int skip, char * filename ) {
@ -309,7 +296,6 @@ int ds_load(int skip, char * filename ) {
char rawname[100];
if (skip) {
//mprintf( 0, "Skipping registered-only sound '%s'\n", filename );
return 0; //don't know what I should return here //&bogus_sound;
}
@ -330,10 +316,7 @@ int ds_load(int skip, char * filename ) {
cfclose(cfp);
new.bits = 8;
new.freq = 11025;
// -- mprintf( (0, "S" ));
// -- mprintf( (0, "<%s>", rawname ));
} else {
mprintf( (1, "Warning: Couldn't find '%s'\n", filename ));
return 255;
}
i = piggy_register_sound( &new, fname, 0 );
@ -459,8 +442,6 @@ int gamedata_read_tbl(int pc_shareware)
WallAnims[i].num_frames = -1;
Num_wall_anims = 0;
setbuf(stdout, NULL); // unbuffered output via printf
if (Installed)
return 1;
@ -481,7 +462,6 @@ int gamedata_read_tbl(int pc_shareware)
char *t;
for (t=inputline;*t && *t!='\n';t++)
if (! (*t==' ' || *t=='\t')) {
mprintf((1,"Suspicious: line %d of BITMAPS.TBL starts with whitespace\n",linenum));
break;
}
}
@ -648,7 +628,6 @@ int gamedata_read_tbl(int pc_shareware)
for (i=used=0; i<num_sounds; i++ )
if (Sounds[i] != 255)
used++;
mprintf((0,"Sound slots used: %d of %d, highest index %d\n",used,MAX_SOUNDS,num_sounds));
//make sure all alt sounds refer to valid main sounds
for (i=used=0; i<num_sounds; i++ ) {
@ -675,12 +654,11 @@ void verify_textures()
for (i=0; i<Num_tmaps; i++ ) {
bmp = &GameBitmaps[Textures[i].index];
if ( (bmp->bm_w!=64)||(bmp->bm_h!=64)||(bmp->bm_rowsize!=64) ) {
mprintf( (1, "ERROR: Texture '%s' isn't 64x64 !\n", TmapInfo[i].filename ));
j++;
}
}
if (j)
Error("%d textures were not 64x64. See mono screen for list.",j);
Error("%d textures were not 64x64.",j);
for (i=0;i<Num_effects;i++)
if (Effects[i].changing_object_texture != -1)
@ -811,7 +789,6 @@ void bm_read_eclip(int skip)
ab_load(skip, arg, bm, &Effects[clip_num].vc.num_frames );
//printf("EC%d.", clip_num);
Effects[clip_num].vc.play_time = fl2f(play_time);
Effects[clip_num].vc.frame_time = Effects[clip_num].vc.play_time/Effects[clip_num].vc.num_frames;
@ -959,7 +936,6 @@ void bm_read_wclip(int skip)
abm_flag = 0;
ab_load(0, arg, bm, &nframes );
WallAnims[clip_num].num_frames = nframes;
//printf("WC");
WallAnims[clip_num].play_time = fl2f(play_time);
//WallAnims[clip_num].frame_time = fl2f(play_time)/nframes;
WallAnims[clip_num].open_sound = wall_open_sound;
@ -974,7 +950,6 @@ void bm_read_wclip(int skip)
set_lighting_flag(&GameBitmaps[bm[clip_count].index].bm_flags);
for (clip_count=0;clip_count < WallAnims[clip_num].num_frames; clip_count++) {
//printf("%d", clip_count);
Textures[texture_count] = bm[clip_count];
set_lighting_flag(&GameBitmaps[bm[clip_count].index].bm_flags);
WallAnims[clip_num].frames[clip_count] = texture_count;
@ -1024,7 +999,6 @@ void bm_read_vclip(int skip)
rod_flag=0;
Vclip[clip_num].flags |= VF_ROD;
}
//printf("VC");
Vclip[clip_num].play_time = fl2f(play_time);
Vclip[clip_num].frame_time = fl2f(play_time)/Vclip[clip_num].num_frames;
Vclip[clip_num].light_value = fl2f(vlighting);
@ -1032,7 +1006,6 @@ void bm_read_vclip(int skip)
set_lighting_flag(&GameBitmaps[bm[clip_count].index].bm_flags);
for (clip_count=0;clip_count < Vclip[clip_num].num_frames; clip_count++) {
//printf("%d", clip_count);
set_lighting_flag(&GameBitmaps[bm[clip_count].index].bm_flags);
Vclip[clip_num].frames[clip_count] = bm[clip_count];
}
@ -1075,7 +1048,6 @@ void adjust_field_of_view(fix *fovp)
for (i=0; i<NDL; i++) {
ff = - f2fl(fovp[i]);
if (ff > 179) {
mprintf((1, "Warning: Bogus field of view (%7.3f). Must be in 0..179.\n", ff));
ff = 179;
}
ff = ff/360;
@ -1268,7 +1240,6 @@ void bm_read_robot(int skip)
} else if (!stricmp( arg, "lighting" )) {
lighting = fl2f(atof(equal_ptr));
if ( (lighting < 0) || (lighting > F1_0 )) {
mprintf( (1, "In bitmaps.tbl, lighting value of %.2f is out of range 0..1.\n", f2fl(lighting)));
Error( "In bitmaps.tbl, lighting value of %.2f is out of range 0..1.\n", f2fl(lighting));
}
} else if (!stricmp( arg, "weapon_type" )) {
@ -1362,7 +1333,6 @@ void bm_read_robot(int skip)
Assert(n_models < MAX_MODEL_VARIANTS);
} else {
Int3();
mprintf( (1, "Invalid parameter, %s=%s in bitmaps.tbl\n", arg, equal_ptr ));
}
} else { // Must be a texture specification...
load_polymodel_bitmap(skip, arg);
@ -1394,7 +1364,6 @@ void bm_read_robot(int skip)
}
if ((glow > i2f(15)) || (glow < 0) || (glow != 0 && glow < 0x1000)) {
mprintf((0,"Invalid glow value %x for robot %d\n",glow,N_robot_types));
Int3();
}
@ -1498,14 +1467,12 @@ void bm_read_reactor(void)
} else if (!stricmp( arg, "lighting" )) {
lighting = fl2f(atof(equal_ptr));
if ( (lighting < 0) || (lighting > F1_0 )) {
mprintf( (1, "In bitmaps.tbl, lighting value of %.2f is out of range 0..1.\n", f2fl(lighting)));
Error( "In bitmaps.tbl, lighting value of %.2f is out of range 0..1.\n", f2fl(lighting));
}
} else if (!stricmp( arg, "strength" )) {
strength = fl2f(atof(equal_ptr));
} else {
Int3();
mprintf( (1, "Invalid parameter, %s=%s in bitmaps.tbl\n", arg, equal_ptr ));
}
} else { // Must be a texture specification...
load_polymodel_bitmap(0, arg);
@ -1557,7 +1524,6 @@ void bm_read_marker()
equal_ptr++;
// if we have john=cool, arg is 'john' and equal_ptr is 'cool'
mprintf( (1, "Invalid parameter, %s=%s in bitmaps.tbl\n", arg, equal_ptr ));
Int3();
} else { // Must be a texture specification...
@ -1575,7 +1541,7 @@ void bm_read_marker()
void bm_read_exitmodel()
{
char *model_name, *model_name_dead=NULL;
int first_bitmap_num, first_bitmap_num_dead, n_normal_bitmaps;
int first_bitmap_num=0, first_bitmap_num_dead=0, n_normal_bitmaps;
char *equal_ptr;
short model_num;
@ -1601,7 +1567,6 @@ void bm_read_exitmodel()
first_bitmap_num_dead=N_ObjBitmapPtrs;
} else {
Int3();
mprintf( (1, "Invalid parameter, %s=%s in bitmaps.tbl\n", arg, equal_ptr ));
}
} else { // Must be a texture specification...
load_polymodel_bitmap(0, arg);
@ -1691,7 +1656,6 @@ void bm_read_player_ship(void)
Player_ship->expl_vclip_num=atoi(equal_ptr);
else {
Int3();
mprintf( (1, "Invalid parameter, %s=%s in bitmaps.tbl\n", arg, equal_ptr ));
}
}
else if (!stricmp( arg, "multi_textures" )) {
@ -2042,7 +2006,6 @@ void bm_read_weapon(int skip, int unused_flag)
}
} else {
Int3();
mprintf( (1, "Invalid parameter, %s=%s in bitmaps.tbl\n", arg, equal_ptr ));
}
} else { // Must be a texture specification...
grs_bitmap *bm;
@ -2080,17 +2043,8 @@ void bm_read_weapon(int skip, int unused_flag)
Assert(n_models);
Weapon_info[n].model_num_inner = load_polygon_model(pof_file_inner,first_bitmap_num[1]-first_bitmap_num[0],first_bitmap_num[0],NULL);
}
if ((Weapon_info[n].ammo_usage == 0) && (Weapon_info[n].energy_usage == 0))
mprintf((1, "Warning: Weapon %i has ammo and energy usage of 0.\n", n));
// -- render type of none is now legal -- Assert( Weapon_info[n].render_type != WEAPON_RENDER_NONE );
}
// ------------------------------------------------------------------------------
#define DEFAULT_POWERUP_SIZE i2f(3)
@ -2139,11 +2093,9 @@ void bm_read_powerup(int unused_flag)
Powerup_info[n].size = fl2f(atof(equal_ptr));
} else {
Int3();
mprintf( (1, "Invalid parameter, %s=%s in bitmaps.tbl\n", arg, equal_ptr ));
}
} else { // Must be a texture specification...
Int3();
mprintf( (1, "Invalid argument, %s in bitmaps.tbl\n", arg ));
}
arg = strtok( NULL, space );
}
@ -2174,12 +2126,10 @@ void bm_read_hostage()
else {
Int3();
mprintf( (1, "Invalid parameter, %s=%s in bitmaps.tbl\n", arg, equal_ptr ));
}
} else {
Int3();
mprintf( (1, "Invalid argument, %s in bitmaps.tbl at line %d\n", arg, linenum ));
}
arg = strtok( NULL, space );
}

View File

@ -1,65 +0,0 @@
#ifdef HAVE_CONFIG_H
#include <conf.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "pstypes.h"
#include "cmd.h"
#include "console.h"
#include "error.h"
/* ======
* cmd_parse - Parse an input string
* ======
*/
void cmd_parse(char *input)
{
char buffer[CMD_MAX_LENGTH];
char *tokens[CMD_MAX_TOKENS];
int num_tokens;
int i, l;
Assert(input != NULL);
/* Strip leading spaces */
for (i=0; isspace(input[i]); i++) ;
strncpy( buffer, &input[i], CMD_MAX_LENGTH );
printf("lead strip \"%s\"\n",buffer);
l = strlen(buffer);
/* If command is empty, give up */
if (l==0) return;
/* Strip trailing spaces */
for (i=l-1; i>0 && isspace(buffer[i]); i--) ;
buffer[i+1] = 0;
printf("trail strip \"%s\"\n",buffer);
/* Split into tokens */
l = strlen(buffer);
num_tokens = 1;
tokens[0] = buffer;
for (i=1; i<l; i++) {
if (isspace(buffer[i])) {
buffer[i] = 0;
while (isspace(buffer[i+1]) && (i+1 < l)) i++;
tokens[num_tokens++] = &buffer[i+1];
}
}
/* Check for matching commands */
/* Otherwise */
printf("n_tokens = %d\n", num_tokens);
if (num_tokens>1) {
printf("setting %s %s\n",tokens[0], tokens[1]);
cvar_set(tokens[0], tokens[1]);
} else {
con_printf(CON_NORMAL, "%s: %f\n", tokens[0], cvar(tokens[0]));
}
}

View File

@ -1,4 +1,3 @@
/* $Id: cntrlcen.c,v 1.1.1.1 2006/03/17 19:55:32 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -22,20 +21,14 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include <conf.h>
#endif
#ifdef RCS
static char rcsid[] = "$Id: cntrlcen.c,v 1.1.1.1 2006/03/17 19:55:32 zicodxx Exp $";
#endif
#include <stdlib.h>
#include <stdio.h>
#if !defined(_WIN32) && !defined(macintosh)
#include <unistd.h>
#endif
#include "pstypes.h"
#include "error.h"
#include "mono.h"
#include "inferno.h"
#include "cntrlcen.h"
#include "game.h"
@ -263,7 +256,6 @@ void do_controlcen_destroyed_stuff(object *objp)
rval = !PHYSFS_delete(SECRETC_FILENAME);
mprintf((0, "Deleting secret.sgc, return value = %i\n", rval));
}
if (Base_control_center_explosion_time != DEFAULT_CONTROL_CENTER_EXPLOSION_TIME)
@ -440,15 +432,14 @@ void init_controlcen_for_level(void)
if (objp->type == OBJ_CNTRLCEN)
{
if (cntrlcen_objnum != -1)
mprintf((1, "Warning: Two or more control centers including %i and %i\n", i, cntrlcen_objnum));
;
else
cntrlcen_objnum = i;
}
if ((objp->type == OBJ_ROBOT) && (Robot_info[objp->id].boss_flag)) {
// mprintf((0, "Found boss robot %d.\n", objp->id));
if (boss_objnum != -1)
mprintf((1, "Warning: Two or more bosses including %i and %i\n", i, boss_objnum));
;
else
boss_objnum = i;
}
@ -456,14 +447,12 @@ void init_controlcen_for_level(void)
#ifndef NDEBUG
if (cntrlcen_objnum == -1) {
mprintf((1, "Warning: No control center.\n"));
return;
}
#endif
if ( (boss_objnum != -1) && !((Game_mode & GM_MULTI) && !(Game_mode & GM_MULTI_ROBOTS)) ) {
if (cntrlcen_objnum != -1) {
// mprintf((0, "Ghosting control center\n"));
Objects[cntrlcen_objnum].type = OBJ_GHOST;
Objects[cntrlcen_objnum].render_type = RT_NONE;
Control_center_present = 0;
@ -499,14 +488,12 @@ void init_controlcen_for_level(void)
void special_reactor_stuff(void)
{
mprintf((0, "Mucking with reactor countdown time.\n"));
if (Control_center_destroyed) {
Countdown_timer += i2f(Base_control_center_explosion_time + (NDL-1-Difficulty_level)*Base_control_center_explosion_time/(NDL-1));
Total_countdown_time = f2i(Countdown_timer)+2; // Will prevent "Self destruct sequence activated" message from replaying.
}
}
#ifndef FAST_FILE_IO
/*
* reads n reactor structs from a CFILE
*/
@ -542,7 +529,6 @@ extern int control_center_triggers_read_n(control_center_triggers *cct, int n, C
}
return i;
}
#endif
int control_center_triggers_write(control_center_triggers *cct, PHYSFS_file *fp)
{

View File

@ -81,10 +81,6 @@ extern int Control_center_destroyed,Countdown_seconds_left;
extern int Base_control_center_explosion_time; // how long to blow up on insane
extern int Reactor_strength;
#ifdef FAST_FILE_IO
#define reactor_read_n(r, n, fp) cfread(r, sizeof(reactor), n, fp)
#define control_center_triggers_read_n(cct, n, fp) cfread(cct, sizeof(control_center_triggers), n, fp)
#else
/*
* reads n reactor structs from a CFILE
*/
@ -94,7 +90,6 @@ extern int reactor_read_n(reactor *r, int n, CFILE *fp);
* reads n control_center_triggers structs from a CFILE
*/
extern int control_center_triggers_read_n(control_center_triggers *cct, int n, CFILE *fp);
#endif
extern int control_center_triggers_write(control_center_triggers *cct, PHYSFS_file *fp);

View File

@ -1,4 +1,3 @@
/* $Id: collide.c,v 1.1.1.1 2006/03/17 19:54:41 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -31,8 +30,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "gr.h"
#include "stdlib.h"
#include "bm.h"
//#include "error.h"
#include "mono.h"
#include "3d.h"
#include "segment.h"
#include "texmap.h"
@ -102,7 +99,6 @@ void collide_robot_and_wall( object * robot, fix hitspeed, short hitseg, short h
int wall_num = Segments[hitseg].sides[hitwall].wall_num;
if (wall_num != -1) {
if ((Walls[wall_num].type == WALL_DOOR) && (Walls[wall_num].keys == KEY_NONE) && (Walls[wall_num].state == WALL_DOOR_CLOSED) && !(Walls[wall_num].flags & WALL_DOOR_LOCKED)) {
// -- mprintf((0, "Trying to open door at segment %i, side %i\n", hitseg, hitwall));
wall_open_door(&Segments[hitseg], hitwall);
// -- Changed from this, 10/19/95, MK: Don't want buddy getting stranded from player
//-- } else if ((Robot_info[robot->id].companion == 1) && (Walls[wall_num].type == WALL_DOOR) && (Walls[wall_num].keys != KEY_NONE) && (Walls[wall_num].state == WALL_DOOR_CLOSED) && !(Walls[wall_num].flags & WALL_DOOR_LOCKED)) {
@ -162,8 +158,6 @@ void apply_force_damage(object *obj,fix force,object *other_obj)
if ((other_obj->type == OBJ_PLAYER) && Monster_mode)
damage = 0x7fffffff;
//mprintf((0,"obj %d, damage=%x\n",obj-Objects,damage));
switch (obj->type) {
case OBJ_ROBOT:
@ -447,8 +441,6 @@ void scrape_object_on_wall(object *obj, short hitseg, short hitside, vms_vector
if (obj->id==Player_num) {
int type;
//mprintf((0, "Scraped segment #%3i, side #%i\n", hitseg, hitside));
if ((type=check_volatile_wall(obj,hitseg,hitside,hitpt))!=0) {
vms_vector hit_dir, rand_vec;
@ -559,8 +551,6 @@ int check_effect_blowup(segment *seg,int side,vms_vector *pnt, object *blower, i
case 0xc000: t=x; x=y; y=bm->bm_h-t-1; break;
}
//mprintf((0,"u,v = %x,%x x,y=%x,%x",u,v,x,y));
if (bm->bm_flags & BM_FLAG_RLE)
bm = rle_expand_texture(bm);
}
@ -576,8 +566,6 @@ int check_effect_blowup(segment *seg,int side,vms_vector *pnt, object *blower, i
return(0);
#endif
//mprintf((0," HIT!\n"));
//note: this must get called before the texture changes,
//because we use the light value of the texture to change
//the static light in the segment
@ -611,8 +599,6 @@ int check_effect_blowup(segment *seg,int side,vms_vector *pnt, object *blower, i
new_ec = &Effects[Effects[ec].dest_eclip];
bm_num = new_ec->changing_wall_texture;
mprintf((0,"bm_num = %d\n",bm_num));
new_ec->time_left = new_ec->vc.frame_time;
new_ec->frame_count = 0;
new_ec->segnum = seg-Segments;
@ -663,15 +649,13 @@ int ok_to_do_omega_damage(object *weapon)
return 1;
if (Objects[parent_num].signature != parent_sig)
mprintf((0, "Parent of omega blob not consistent with object information.\n"));
;
else {
fix dist = vm_vec_dist_quick(&Objects[parent_num].pos, &weapon->pos);
if (dist > MAX_OMEGA_DIST) {
// -- mprintf((0, "Not doing damage in frame %i, too far away.\n", FrameCount));
return 0;
} else
; // -- mprintf((0, "*** Doing damage in frame %i ***\n", FrameCount));
}
}
return 1;
@ -702,9 +686,7 @@ void collide_weapon_and_wall( object * weapon, fix hitspeed, short hitseg, short
fix dot;
dot = vm_vec_dot(&weapon->orient.fvec, &Segments[hitseg].sides[hitwall].normals[0]);
mprintf((0, "Guided missile dot = %7.3f\n", f2fl(dot)));
if (dot < -F1_0/6) {
mprintf((0, "Guided missile loses bounciness.\n"));
weapon->mtype.phys_info.flags &= ~PF_BOUNCE;
}
}
@ -727,7 +709,6 @@ void collide_weapon_and_wall( object * weapon, fix hitspeed, short hitseg, short
if (keyd_pressed[KEY_LAPOSTRO])
if (weapon->ctype.laser_info.parent_num == Players[Player_num].objnum) {
// MK: Real pain when you need to know a seg:side and you've got quad lasers.
mprintf((0, "Your laser hit at segment = %i, side = %i\n", hitseg, hitwall));
HUD_init_message("Hit at segment = %i, side = %i", hitseg, hitwall);
if (weapon->id < 4)
subtract_light(hitseg, hitwall);
@ -798,7 +779,6 @@ void collide_weapon_and_wall( object * weapon, fix hitspeed, short hitseg, short
// New by MK: If powerful badass, explode as badass, not due to lava, fixes megas being wimpy in lava.
if (wi->damage_radius >= VOLATILE_WALL_DAMAGE_RADIUS/2) {
// -- mprintf((0, "Big weapon doing badass in lava instead.\n"));
explode_badass_weapon(weapon,hitpt);
} else {
object_create_badass_explosion( weapon, hitseg, hitpt,
@ -917,7 +897,6 @@ void collide_weapon_and_wall( object * weapon, fix hitspeed, short hitseg, short
break;
}
} // else
//mprintf((0, "Weapon %i hits wall, but has silent bit set.\n", weapon-Objects));
} // else {
// if (weapon->lifeleft <= 0)
// weapon->flags |= OF_SHOULD_BE_DEAD;
@ -981,11 +960,6 @@ void collide_debris_and_wall( object * debris, fix hitspeed, short hitseg, short
// -------------------------------------------------------------------------------------------------------------------
void collide_robot_and_robot( object * robot1, object * robot2, vms_vector *collision_point ) {
// mprintf((0, "Coll: [%2i %4i %4i %4i] [%2i %4i %4i %4i] at [%4i %4i %4i]",
// robot1-Objects, f2i(robot1->pos.x), f2i(robot1->pos.y), f2i(robot1->pos.z),
// robot2-Objects, f2i(robot2->pos.x), f2i(robot2->pos.y), f2i(robot2->pos.z),
// f2i(collision_point->x), f2i(collision_point->y), f2i(collision_point->z)));
bump_two_objects(robot1, robot2, 1);
return;
}
@ -1098,7 +1072,6 @@ void apply_damage_to_controlcen(object *controlcen, fix damage, short who)
whotype = Objects[who].type;
if (whotype != OBJ_PLAYER) {
mprintf((0, "Damage to control center by object of type %i prevented by MK!\n", whotype));
return;
}
@ -1164,8 +1137,6 @@ void collide_player_and_controlcen( object * controlcen, object * playerobj, vms
void collide_player_and_marker( object * marker, object * playerobj, vms_vector *collision_point )
{
mprintf ((0,"Collided with marker %d!\n",marker->id));
if (playerobj->id==Player_num) {
int drawn;
@ -1500,8 +1471,6 @@ int do_boss_weapon_collision(object *robot, object *weapon, vms_vector *collisio
vm_vec_sub(&tvec1, collision_point, &robot->pos);
vm_vec_normalize_quick(&tvec1); // Note, if BOSS_INVULNERABLE_DOT is close to F1_0 (in magnitude), then should probably use non-quick version.
dot = vm_vec_dot(&tvec1, &robot->orient.fvec);
mprintf((0, "Boss hit vec dot = %7.3f\n", f2fl(dot)));
if (dot > Boss_invulnerable_dot) {
int new_obj;
int segnum;
@ -1607,8 +1576,6 @@ void collide_robot_and_weapon( object * robot, object * weapon, vms_vector *coll
return;
else
weapon->ctype.laser_info.last_hitobj = robot-Objects;
// mprintf((0, "weapon #%i with power %i hits robot #%i.\n", weapon - Objects, f2i(weapon->shields), robot - Objects));
}
if (weapon->ctype.laser_info.parent_signature == robot->signature)
@ -1849,8 +1816,6 @@ void drop_missile_1_or_4(object *playerobj,int missile_index)
void drop_player_eggs(object *playerobj)
{
// mprintf((0, "In drop_player_eggs...\n"));
if ((playerobj->type == OBJ_PLAYER) || (playerobj->type == OBJ_GHOST)) {
int rthresh;
int pnum = playerobj->id;
@ -1950,8 +1915,6 @@ void drop_player_eggs(object *playerobj)
int max_count,i;
mprintf ((0,"HOARD MODE: Dropping %d orbs\n",Players[pnum].secondary_ammo[PROXIMITY_INDEX]));
max_count = min(Players[pnum].secondary_ammo[PROXIMITY_INDEX], 12);
for (i=0; i<max_count; i++)
call_object_create_egg(playerobj, 1, OBJ_POWERUP, POW_HOARD_ORB);
@ -2006,7 +1969,6 @@ void drop_player_eggs(object *playerobj)
if (!(Players[playerobj->id].primary_weapon_flags & HAS_VULCAN_FLAG)) {
int amount = Players[playerobj->id].primary_ammo[VULCAN_INDEX];
if (amount > 200) {
mprintf((0, "Surprising amount of vulcan ammo: %i bullets.\n", amount));
amount = 200;
}
while (amount > 0) {
@ -2133,22 +2095,6 @@ void apply_damage_to_player(object *playerobj, object *killer, fix damage)
if (killer && (killer->type == OBJ_ROBOT) && (Robot_info[killer->id].companion))
Buddy_sorry_time = GameTime;
}
// -- removed, 09/06/95, MK -- else if (Players[Player_num].shields < LOSE_WEAPON_THRESHOLD) {
// -- removed, 09/06/95, MK -- int randnum = d_rand();
// -- removed, 09/06/95, MK --
// -- removed, 09/06/95, MK -- if (fixmul(Players[Player_num].shields, randnum) < damage/4) {
// -- removed, 09/06/95, MK -- if (d_rand() > 20000) {
// -- removed, 09/06/95, MK -- destroy_secondary_weapon(Secondary_weapon);
// -- removed, 09/06/95, MK -- } else if (Primary_weapon == 0) {
// -- removed, 09/06/95, MK -- if (Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS)
// -- removed, 09/06/95, MK -- destroy_primary_weapon(MAX_PRIMARY_WEAPONS); // This means to destroy quad laser.
// -- removed, 09/06/95, MK -- else if (Players[Player_num].laser_level > 0)
// -- removed, 09/06/95, MK -- destroy_primary_weapon(Primary_weapon);
// -- removed, 09/06/95, MK -- } else
// -- removed, 09/06/95, MK -- destroy_primary_weapon(Primary_weapon);
// -- removed, 09/06/95, MK -- } else
// -- removed, 09/06/95, MK -- ; // mprintf((0, "%8x > %8x, so don't lose weapon.\n", fixmul(Players[Player_num].shields, randnum), damage/4));
// -- removed, 09/06/95, MK -- }
playerobj->shields = Players[Player_num].shields; //mirror
@ -2509,8 +2455,6 @@ void collide_two_objects( object * A, object * B, vms_vector *collision_point )
collision_type = COLLISION_OF(A->type,B->type);
//mprintf( (0, "Object %d of type %d collided with object %d of type %d\n", A-Objects,A->type, B-Objects, B->type ));
switch( collision_type ) {
NO_SAME_COLLISION( OBJ_FIREBALL, OBJ_FIREBALL, collide_fireball_and_fireball )
DO_SAME_COLLISION( OBJ_ROBOT, OBJ_ROBOT, collide_robot_and_robot )

View File

@ -1,4 +1,3 @@
/* $Id: config.c,v 1.1.1.1 2006/03/17 19:55:48 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -27,13 +26,12 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#if !(defined(__APPLE__) && defined(__MACH__))
#include <physfs.h>
#else
#include <physfs/physfs.h>
#endif
#include "config.h"
#include "pstypes.h"
#include "game.h"
#include "menu.h"
@ -46,54 +44,47 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "args.h"
#include "player.h"
#include "mission.h"
#include "mono.h"
#include "physfsx.h"
struct Cfg GameCfg;
ubyte Config_digi_volume = 8;
ubyte Config_midi_volume = 8;
ubyte Config_redbook_volume = 8;
ubyte Config_control_type = 0;
ubyte Config_channels_reversed = 0;
ubyte Config_joystick_sensitivity = 8;
static char *DigiVolumeStr = "DigiVolume";
static char *MidiVolumeStr = "MidiVolume";
static char *RedbookVolumeStr = "RedbookVolume";
static char *ReverseStereoStr = "ReverseStereo";
static char *DetailLevelStr = "DetailLevel";
static char *GammaLevelStr = "GammaLevel";
static char *LastPlayerStr = "LastPlayer";
static char *LastMissionStr = "LastMission";
static char *ResolutionXStr="ResolutionX";
static char *ResolutionYStr="ResolutionY";
static int Config_render_width=0, Config_render_height=0;
char config_last_player[CALLSIGN_LEN+1] = "";
char config_last_mission[MISSION_NAME_LEN+1] = "";
int Config_digi_type = 0;
int Config_digi_dma = 0;
int Config_midi_type = 0;
extern sbyte Object_complexity, Object_detail, Wall_detail, Wall_render_depth, Debris_amount, SoundChannels;
void set_custom_detail_vars(void);
#define CL_MC0 0xF8F
#define CL_MC1 0xF8D
static char *AspectXStr="AspectX";
static char *AspectYStr="AspectY";
static char *WindowModeStr="WindowMode";
static char *TexFiltStr="TexFilt";
int ReadConfigFile()
{
PHYSFS_file *infile;
char line[80], *token, *value, *ptr;
ubyte gamma;
strcpy( config_last_player, "" );
// set defaults
GameCfg.DigiVolume = 8;
GameCfg.MidiVolume = 8;
GameCfg.RedbookVolume = 8;
GameCfg.ReverseStereo = 0;
GameCfg.GammaLevel = 0;
memset(GameCfg.LastPlayer,0,CALLSIGN_LEN+1);
memset(GameCfg.LastMission,0,MISSION_NAME_LEN+1);
GameCfg.ResolutionX = 640;
GameCfg.ResolutionY = 480;
GameCfg.AspectX = 3;
GameCfg.AspectY = 4;
GameCfg.WindowMode = 0;
GameCfg.TexFilt = 0;
Config_digi_volume = 8;
Config_midi_volume = 8;
Config_redbook_volume = 8;
Config_control_type = 0;
infile = PHYSFSX_openReadBuffered("descent.cfg");
@ -115,64 +106,54 @@ int ReadConfigFile()
if (!value)
value = "";
if (!strcmp(token, DigiVolumeStr))
Config_digi_volume = strtol(value, NULL, 10);
GameCfg.DigiVolume = strtol(value, NULL, 10);
else if (!strcmp(token, MidiVolumeStr))
Config_midi_volume = strtol(value, NULL, 10);
GameCfg.MidiVolume = strtol(value, NULL, 10);
else if (!strcmp(token, RedbookVolumeStr))
Config_redbook_volume = strtol(value, NULL, 10);
GameCfg.RedbookVolume = strtol(value, NULL, 10);
else if (!strcmp(token, ReverseStereoStr))
Config_channels_reversed = strtol(value, NULL, 10);
GameCfg.ReverseStereo = strtol(value, NULL, 10);
else if (!strcmp(token, GammaLevelStr)) {
gamma = strtol(value, NULL, 10);
gr_palette_set_gamma( gamma );
}
else if (!strcmp(token, DetailLevelStr)) {
Detail_level = strtol(value, NULL, 10);
if (Detail_level == NUM_DETAIL_LEVELS-1) {
int count,dummy,oc,od,wd,wrd,da,sc;
count = sscanf (value, "%d,%d,%d,%d,%d,%d,%d\n",&dummy,&oc,&od,&wd,&wrd,&da,&sc);
if (count == 7) {
Object_complexity = oc;
Object_detail = od;
Wall_detail = wd;
Wall_render_depth = wrd;
Debris_amount = da;
SoundChannels = sc;
set_custom_detail_vars();
}
}
GameCfg.GammaLevel = strtol(value, NULL, 10);
gr_palette_set_gamma( GameCfg.GammaLevel );
}
else if (!strcmp(token, LastPlayerStr)) {
char * p;
strncpy( config_last_player, value, CALLSIGN_LEN );
p = strchr( config_last_player, '\n');
strncpy( GameCfg.LastPlayer, value, CALLSIGN_LEN );
p = strchr( GameCfg.LastPlayer, '\n');
if ( p ) *p = 0;
}
else if (!strcmp(token, LastMissionStr)) {
char * p;
strncpy( config_last_mission, value, MISSION_NAME_LEN );
p = strchr( config_last_mission, '\n');
strncpy( GameCfg.LastMission, value, MISSION_NAME_LEN );
p = strchr( GameCfg.LastMission, '\n');
if ( p ) *p = 0;
}
else if (!strcmp(token, ResolutionXStr))
Config_render_width = strtol(value, NULL, 10);
GameCfg.ResolutionX = strtol(value, NULL, 10);
else if (!strcmp(token, ResolutionYStr))
Config_render_height = strtol(value, NULL, 10);
GameCfg.ResolutionY = strtol(value, NULL, 10);
else if (!strcmp(token, AspectXStr))
GameCfg.AspectX = strtol(value, NULL, 10);
else if (!strcmp(token, AspectYStr))
GameCfg.AspectY = strtol(value, NULL, 10);
else if (!strcmp(token, WindowModeStr))
GameCfg.WindowMode = strtol(value, NULL, 10);
else if (!strcmp(token, TexFiltStr))
GameCfg.TexFilt = strtol(value, NULL, 10);
}
}
PHYSFS_close(infile);
if ( Config_digi_volume > 8 ) Config_digi_volume = 8;
if ( Config_midi_volume > 8 ) Config_midi_volume = 8;
if ( Config_redbook_volume > 8 ) Config_redbook_volume = 8;
if ( GameCfg.DigiVolume > 8 ) GameCfg.DigiVolume = 8;
if ( GameCfg.MidiVolume > 8 ) GameCfg.MidiVolume = 8;
if ( GameCfg.RedbookVolume > 8 ) GameCfg.RedbookVolume = 8;
digi_set_volume( (Config_digi_volume*32768)/8, (Config_midi_volume*128)/8 );
digi_set_volume( (GameCfg.DigiVolume*32768)/8, (GameCfg.MidiVolume*128)/8 );
if (Config_render_width >= 320 && Config_render_height >= 200)
Game_screen_mode = SM(Config_render_width,Config_render_height);
if (GameCfg.ResolutionX >= 320 && GameCfg.ResolutionY >= 200)
Game_screen_mode = SM(GameCfg.ResolutionX,GameCfg.ResolutionY);
return 0;
}
@ -180,7 +161,8 @@ int ReadConfigFile()
int WriteConfigFile()
{
PHYSFS_file *infile;
ubyte gamma = gr_palette_get_gamma();
GameCfg.GammaLevel = gr_palette_get_gamma();
infile = PHYSFSX_openWriteBuffered("descent.cfg");
@ -188,20 +170,19 @@ int WriteConfigFile()
return 1;
}
PHYSFSX_printf(infile,"%s=%d\n", DigiVolumeStr, Config_digi_volume);
PHYSFSX_printf(infile,"%s=%d\n", MidiVolumeStr, Config_midi_volume);
PHYSFSX_printf(infile,"%s=%d\n", RedbookVolumeStr, Config_redbook_volume);
PHYSFSX_printf(infile,"%s=%d\n", ReverseStereoStr, Config_channels_reversed);
PHYSFSX_printf(infile,"%s=%d\n", GammaLevelStr, gamma);
if (Detail_level == NUM_DETAIL_LEVELS-1)
PHYSFSX_printf(infile,"%s=%d,%d,%d,%d,%d,%d,%d\n", DetailLevelStr, Detail_level,
Object_complexity,Object_detail,Wall_detail,Wall_render_depth,Debris_amount,SoundChannels);
else
PHYSFSX_printf(infile,"%s=%d\n", DetailLevelStr, Detail_level);
PHYSFSX_printf(infile,"%s=%s\n", LastPlayerStr, Players[Player_num].callsign );
PHYSFSX_printf(infile,"%s=%s\n", LastMissionStr, config_last_mission );
PHYSFSX_printf(infile,"%s=%i\n", ResolutionXStr, SM_W(Game_screen_mode));
PHYSFSX_printf(infile,"%s=%i\n", ResolutionYStr, SM_H(Game_screen_mode));
PHYSFSX_printf(infile, "%s=%d\n", DigiVolumeStr, GameCfg.DigiVolume);
PHYSFSX_printf(infile, "%s=%d\n", MidiVolumeStr, GameCfg.MidiVolume);
PHYSFSX_printf(infile, "%s=%d\n", RedbookVolumeStr, GameCfg.RedbookVolume);
PHYSFSX_printf(infile, "%s=%d\n", ReverseStereoStr, GameCfg.ReverseStereo);
PHYSFSX_printf(infile, "%s=%d\n", GammaLevelStr, GameCfg.GammaLevel);
PHYSFSX_printf(infile, "%s=%s\n", LastPlayerStr, Players[Player_num].callsign );
PHYSFSX_printf(infile, "%s=%s\n", LastMissionStr, GameCfg.LastMission );
PHYSFSX_printf(infile, "%s=%i\n", ResolutionXStr, SM_W(Game_screen_mode));
PHYSFSX_printf(infile, "%s=%i\n", ResolutionYStr, SM_H(Game_screen_mode));
PHYSFSX_printf(infile, "%s=%i\n", AspectXStr, GameCfg.AspectX);
PHYSFSX_printf(infile, "%s=%i\n", AspectYStr, GameCfg.AspectY);
PHYSFSX_printf(infile, "%s=%i\n", WindowModeStr, GameCfg.WindowMode);
PHYSFSX_printf(infile, "%s=%i\n", TexFiltStr, GameCfg.TexFilt);
PHYSFS_close(infile);

View File

@ -1,4 +1,3 @@
/* $Id: config.h,v 1.1.1.1 2006/03/17 19:55:48 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -23,37 +22,31 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#define _CONFIG_H
#include "player.h"
#include "mission.h"
typedef struct Cfg
{
ubyte DigiVolume;
ubyte MidiVolume;
ubyte RedbookVolume;
int ReverseStereo;
int GammaLevel;
char LastPlayer[CALLSIGN_LEN+1];
char LastMission[MISSION_NAME_LEN+1];
int ResolutionX;
int ResolutionY;
int AspectX;
int AspectY;
int WindowMode;
int TexFilt;
} __attribute__ ((packed)) Cfg;
extern struct Cfg GameCfg;
extern int ReadConfigFile(void);
extern int WriteConfigFile(void);
extern char config_last_player[CALLSIGN_LEN+1];
extern char config_last_mission[];
extern ubyte Config_digi_volume;
extern ubyte Config_midi_volume;
#ifdef MACINTOSH
typedef struct ConfigInfoStruct
{
ubyte mDoNotDisplayOptions;
ubyte mUse11kSounds;
ubyte mDisableSound;
ubyte mDisableMIDIMusic;
ubyte mChangeResolution;
ubyte mDoNotPlayMovies;
ubyte mUserChoseQuit;
ubyte mGameMonitor;
ubyte mAcceleration; // allow RAVE level acceleration
ubyte mInputSprockets; // allow use of Input Sprocket devices
} ConfigInfo;
extern ConfigInfo gConfigInfo;
extern ubyte Config_master_volume;
#endif
extern ubyte Config_redbook_volume;
extern ubyte Config_control_type;
extern ubyte Config_channels_reversed;
extern ubyte Config_joystick_sensitivity;
extern ubyte Config_mouse_sensitivity;
extern int joy_deadzone;

View File

@ -1,8 +1,6 @@
/* $Id: console.c,v 1.1.1.1 2006/03/17 19:55:36 zicodxx Exp $ */
/*
*
* Code for controlling the console
*
* Game console
*
*/
@ -14,163 +12,64 @@
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#ifndef _WIN32_WCE
#include <fcntl.h>
#endif
#include <ctype.h>
#include <time.h>
#include <SDL/SDL.h>
#ifdef CONSOLE
#include "CON_console.h"
#endif
#include "pstypes.h"
#include "u_mem.h"
#include "error.h"
#include "console.h"
#include "cmd.h"
#include "args.h"
#include "gr.h"
#include "physfsx.h"
#include "gamefont.h"
#include "pcx.h"
#include "cfile.h"
#include "key.h"
#include "vers_id.h"
#include "timer.h"
#ifndef __MSDOS__
int text_console_enabled = 1;
#else
int isvga();
#define text_console_enabled (!isvga())
#endif
PHYSFS_file *gamelog_fp=NULL;
struct console_buffer con_buffer[CON_LINES_MAX];
int con_render=0;
static int con_scroll_offset=0;
cvar_t *cvar_vars = NULL;
/* Console specific cvars */
/* How discriminating we are about which messages are displayed */
cvar_t con_threshold = {"con_threshold", "0",};
/* Private console stuff */
#define CON_NUM_LINES 40
#if 0
#define CON_LINE_LEN 40
static char con_display[40][40];
static int con_line; /* Current display line */
#endif
#ifdef CONSOLE
static int con_initialized;
ConsoleInformation *Console;
void con_parse(ConsoleInformation *console, char *command);
/* ======
* con_free - Free the console.
* ======
*/
void con_free(void)
void con_add_buffer_line(int priority, char *buffer)
{
if (con_initialized)
CON_Free(Console);
con_initialized = 0;
}
#endif
int i=0;
/* shift con_buffer for one line */
for (i=1; i<CON_LINES_MAX; i++)
{
con_buffer[i-1].priority=con_buffer[i].priority;
memcpy(&con_buffer[i-1].line,&con_buffer[i].line,CON_LINE_LENGTH);
}
memset(con_buffer[CON_LINES_MAX-1].line,'\0',sizeof(CON_LINE_LENGTH));
con_buffer[CON_LINES_MAX-1].priority=priority;
/* ======
* con_init - Initialise the console.
* ======
*/
int con_init(void)
{
/* Initialise the cvars */
cvar_registervariable (&con_threshold);
return 0;
memcpy(&con_buffer[CON_LINES_MAX-1].line,buffer,CON_LINE_LENGTH);
for (i=0; i<CON_LINE_LENGTH; i++)
{
con_buffer[CON_LINES_MAX-1].line[i]=buffer[i];
if (buffer[strlen(buffer)-1] == '\n')
con_buffer[CON_LINES_MAX-1].line[strlen(buffer)-1]='\0';
}
}
#ifdef CONSOLE
#define CON_BG_HIRES (cfexist("scoresb.pcx")?"scoresb.pcx":"scores.pcx")
#define CON_BG_LORES (cfexist("scores.pcx")?"scores.pcx":"scoresb.pcx") // Mac datafiles only have scoresb.pcx
#define CON_BG ((SWIDTH>=640)?CON_BG_HIRES:CON_BG_LORES)
void con_background(char *filename)
{
int pcx_error;
grs_bitmap bmp;
ubyte pal[256*3];
gr_init_bitmap_data(&bmp);
pcx_error = pcx_read_bitmap(filename, &bmp, BM_LINEAR, pal);
Assert(pcx_error == PCX_ERROR_NONE);
gr_remap_bitmap_good(&bmp, pal, -1, -1);
CON_Background(Console, &bmp);
gr_free_bitmap_data(&bmp);
}
void con_init_real(void)
{
Console = CON_Init(GAME_FONT, grd_curscreen, CON_NUM_LINES, 0, 0, SWIDTH, SHEIGHT / 2);
Assert(Console);
CON_SetExecuteFunction(Console, con_parse);
con_background(CON_BG);
con_initialized = 1;
atexit(con_free);
}
#endif
void con_resize(void)
{
#ifdef CONSOLE
if (!con_initialized)
con_init_real();
CON_Font(Console, GAME_FONT, BM_XRGB(63, 63, 63), -1);
CON_Resize(Console, 0, 0, SWIDTH, SHEIGHT / 2);
con_background(CON_BG);
#endif
}
/* ======
* con_printf - Print a message to the console.
* ======
*/
void con_printf(int priority, char *fmt, ...)
{
va_list arglist;
char buffer[2048];
char buffer[CON_LINE_LENGTH];
if (priority <= ((int)con_threshold.value))
memset(buffer,'\0',CON_LINE_LENGTH);
if (priority <= ((int)GameArg.DbgVerbose))
{
char *p1, *p2;
va_start (arglist, fmt);
vsprintf (buffer, fmt, arglist);
va_end (arglist);
#ifdef CONSOLE
if (con_initialized)
CON_Out(Console, buffer);
#endif
/* for (i=0; i<l; i+=CON_LINE_LEN,con_line++)
{
memcpy(con_display, &buffer[i], min(80, l-i));
}*/
if (text_console_enabled)
{
/* Produce a sanitised version and send it to the console */
char *p1, *p2;
p1 = p2 = buffer;
do
switch (*p1)
{
/* Produce a sanitised version and send it to the console */
p1 = p2 = buffer;
do
switch (*p1)
{
case CC_COLOR:
case CC_LSPACING:
p1++;
@ -179,136 +78,134 @@ void con_printf(int priority, char *fmt, ...)
break;
default:
*p2++ = *p1++;
}
while (*p1);
*p2 = 0;
}
while (*p1);
*p2 = 0;
printf(buffer);
/* add given string to con_buffer */
con_add_buffer_line(priority, buffer);
/* Print output to stdout */
printf(buffer);
/* Print output to gamelog.txt */
if (gamelog_fp)
{
struct tm *lt;
time_t t;
t=time(NULL);
lt=localtime(&t);
PHYSFSX_printf(gamelog_fp,"%02i:%02i:%02i ",lt->tm_hour,lt->tm_min,lt->tm_sec);
PHYSFSX_printf(gamelog_fp,"%s",buffer);
}
}
}
/* ======
* con_update - Check for new console input. If it's there, use it.
* ======
*/
void con_update(void)
void con_show(void)
{
#if 0
char buffer[CMD_MAX_LENGTH], *t;
int i=0, y;
static float con_size=0;
static fix next_resize_time=0;
int done=0;
/* Check for new input */
t = fgets(buffer, sizeof(buffer), stdin);
if (t == NULL) return;
if (con_render)
{
if (con_size < CON_LINES_ONSCREEN && next_resize_time <= timer_get_fixed_seconds())
{
con_size++;
next_resize_time=timer_get_fixed_seconds()+(F1_0/70);
}
}
else
{
if (con_size > 0 && next_resize_time <= timer_get_fixed_seconds())
{
con_size--;
next_resize_time=timer_get_fixed_seconds()+(F1_0/70);
}
}
cmd_parse(buffer);
#endif
con_draw();
if (!con_size)
return;
gr_set_curfont(GAME_FONT);
gr_setcolor(0);
Gr_scanline_darkening_level = 1*7;
gr_rect(0,0,SWIDTH,(LINE_SPACING*(con_size))+FSPACY(1));
Gr_scanline_darkening_level = GR_FADE_LEVELS;
y=FSPACY(1)+(LINE_SPACING*con_size);
i+=con_scroll_offset;
while (!done)
{
int w,h,aw;
switch (con_buffer[CON_LINES_MAX-1-i].priority)
{
case CON_CRITICAL:
gr_set_fontcolor(BM_XRGB(28,0,0),-1);
break;
case CON_URGENT:
gr_set_fontcolor(BM_XRGB(54,54,0),-1);
break;
case CON_DEBUG:
case CON_VERBOSE:
gr_set_fontcolor(BM_XRGB(14,14,14),-1);
break;
case CON_HUD:
gr_set_fontcolor(BM_XRGB(0,28,0),-1);
break;
default:
gr_set_fontcolor(255,-1);
break;
}
gr_get_string_size(con_buffer[CON_LINES_MAX-1-i].line,&w,&h,&aw);
y-=h+FSPACY(1);
gr_printf(FSPACX(1),y,"%s",con_buffer[CON_LINES_MAX-1-i].line);
i++;
if (y<=0 || CON_LINES_MAX-1-i <= 0 || i < 0)
done=1;
}
gr_setcolor(0);
gr_rect(0,0,SWIDTH,LINE_SPACING);
gr_set_fontcolor(255,-1);
gr_printf(FSPACX(1),FSPACY(1),"%s LOG", DESCENT_VERSION);
gr_printf(SWIDTH-FSPACX(110),FSPACY(1),"PAGE-UP/DOWN TO SCROLL");
}
int con_events(int key)
{
#ifdef CONSOLE
return CON_Events(key);
#else
return key;
#endif
}
/* ======
* cvar_registervariable - Register a CVar
* ======
*/
void cvar_registervariable (cvar_t *cvar)
{
cvar_t *ptr;
Assert(cvar != NULL);
cvar->next = NULL;
cvar->value = strtod(cvar->string, (char **) NULL);
if (cvar_vars == NULL)
switch (key)
{
cvar_vars = cvar;
} else
{
for (ptr = cvar_vars; ptr->next != NULL; ptr = ptr->next) ;
ptr->next = cvar;
case KEY_PAGEUP:
con_scroll_offset+=CON_SCROLL_OFFSET;
if (con_scroll_offset >= CON_LINES_MAX-1)
con_scroll_offset = CON_LINES_MAX-1;
while (con_buffer[CON_LINES_MAX-1-con_scroll_offset].line[0]=='\0')
con_scroll_offset--;
return 1;
case KEY_PAGEDOWN:
con_scroll_offset-=CON_SCROLL_OFFSET;
if (con_scroll_offset<0)
con_scroll_offset=0;
return 1;
case KEY_SHIFTED + KEY_ESC:
con_render=!con_render;
return 1;
}
return 0;
}
/* ======
* cvar_set - Set a CVar's value
* ======
*/
void cvar_set (char *cvar_name, char *value)
void con_close(void)
{
cvar_t *ptr;
for (ptr = cvar_vars; ptr != NULL; ptr = ptr->next)
if (!strcmp(cvar_name, ptr->name)) break;
if (ptr == NULL) return; // If we didn't find the cvar, give up
ptr->value = strtod(value, (char **) NULL);
if (gamelog_fp)
PHYSFS_close(gamelog_fp);
}
/* ======
* cvar() - Get a CVar's value
* ======
*/
float cvar (char *cvar_name)
void con_init(void)
{
cvar_t *ptr;
memset(con_buffer,0,sizeof(con_buffer));
for (ptr = cvar_vars; ptr != NULL; ptr = ptr->next)
if (!strcmp(cvar_name, ptr->name)) break;
if (ptr == NULL) return 0.0; // If we didn't find the cvar, give up
return ptr->value;
}
/* ==========================================================================
* DRAWING
* ==========================================================================
*/
void con_draw(void)
{
#ifdef CONSOLE
CON_DrawConsole(Console);
#else
#if 0
char buffer[CON_LINE_LEN+1];
int i,j;
for (i = con_line, j=0; j < 20; i = (i+1) % CON_NUM_LINES, j++)
{
memcpy(buffer, con_display[i], CON_LINE_LEN);
buffer[CON_LINE_LEN] = 0;
gr_string(1,j*10,buffer);
}
#endif
#endif
}
void con_show(void)
{
#ifdef CONSOLE
if (!con_initialized)
con_init_real();
CON_Show(Console);
CON_Topmost(Console);
#endif
}
#ifdef CONSOLE
void con_parse(ConsoleInformation *console, char *command)
{
cmd_parse(command);
}
#endif
gamelog_fp = PHYSFSX_openWriteBuffered("gamelog.txt");
atexit(con_close);
}

View File

@ -1,4 +1,3 @@
/* $Id: controls.c,v 1.1.1.1 2006/03/17 19:56:12 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -22,25 +21,19 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include <conf.h>
#endif
#ifdef RCS
static char rcsid[] = "$Id: controls.c,v 1.1.1.1 2006/03/17 19:56:12 zicodxx Exp $";
#endif
#include <stdio.h>
#include <stdlib.h>
#include "pstypes.h"
#include "mono.h"
#include "key.h"
#include "joy.h"
#include "timer.h"
#include "error.h"
#include "inferno.h"
#include "game.h"
#include "object.h"
#include "player.h"
#include "controls.h"
#include "render.h"
#include "args.h"
@ -117,8 +110,6 @@ void read_flying_controls( object * obj )
obj->mtype.phys_info.rotthrust.z = Controls.bank_time;
}
// mprintf( (0, "Rot thrust = %.3f,%.3f,%.3f\n", f2fl(obj->mtype.phys_info.rotthrust.x),f2fl(obj->mtype.phys_info.rotthrust.y), f2fl(obj->mtype.phys_info.rotthrust.z) ));
forward_thrust_time = Controls.forward_thrust_time;
if (Players[Player_num].flags & PLAYER_FLAGS_AFTERBURNER)
@ -195,14 +186,12 @@ void read_flying_controls( object * obj )
// Note, you must check for ft < F1_0/2, else you can get an overflow on the << 15.
if ((ft < F1_0/2) && (ft << 15 <= Player_ship->max_thrust)) {
mprintf((0, "Preventing divide overflow in controls.c for Max_thrust!\n"));
ft = (Player_ship->max_thrust >> 15) + 1;
}
vm_vec_scale( &obj->mtype.phys_info.thrust, fixdiv(Player_ship->max_thrust,ft) );
if ((ft < F1_0/2) && (ft << 15 <= Player_ship->max_rotthrust)) {
mprintf((0, "Preventing divide overflow in controls.c for max_rotthrust!\n"));
ft = (Player_ship->max_thrust >> 15) + 1;
}

View File

@ -37,6 +37,8 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
typedef SAMPLE digi_sound;
#else
typedef struct digi_sound {
int bits;
int freq;
int length;
ubyte * data;
} digi_sound;

View File

@ -1,4 +1,3 @@
/* $Id: digiobj.c,v 1.1.1.1 2006/03/17 19:55:24 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -13,10 +12,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*/
#ifdef RCS
static char rcsid[] = "$Id: digiobj.c,v 1.1.1.1 2006/03/17 19:55:24 zicodxx Exp $";
#endif
#ifdef HAVE_CONFIG_H
#include <conf.h>
#endif
@ -25,19 +20,11 @@ static char rcsid[] = "$Id: digiobj.c,v 1.1.1.1 2006/03/17 19:55:24 zicodxx Exp
#include <stdio.h>
#include <fcntl.h>
#ifdef __MSDOS__
# include <dos.h>
# include <bios.h>
# include <io.h>
# include <conio.h>
#endif
#include <string.h>
#include <ctype.h>
#include "fix.h"
#include "object.h"
#include "mono.h"
#include "timer.h"
#include "joy.h"
#include "digi.h"
@ -46,15 +33,13 @@ static char rcsid[] = "$Id: digiobj.c,v 1.1.1.1 2006/03/17 19:55:24 zicodxx Exp
#include "key.h"
#include "newdemo.h"
#include "game.h"
#ifdef __MSDOS__
#include "dpmi.h"
#endif
#include "error.h"
#include "wall.h"
#include "cfile.h"
#include "piggy.h"
#include "text.h"
#include "kconfig.h"
#include "config.h"
#define SOF_USED 1 // Set if this sample is used
#define SOF_PLAYING 2 // Set if this sample is playing on a channel
@ -153,12 +138,10 @@ void digi_get_sound_loc( vms_matrix * listener, vms_vector * listener_pos, int l
path_distance = find_connected_distance(listener_pos, listener_seg, sound_pos, sound_seg, num_search_segs, WID_RENDPAST_FLAG+WID_FLY_FLAG );
if ( path_distance > -1 ) {
*volume = max_volume - fixdiv(path_distance,max_distance);
//mprintf( (0, "Sound path distance %.2f, volume is %d / %d\n", f2fl(distance), *volume, max_volume ));
if (*volume > 0 ) {
angle_from_ear = vm_vec_delta_ang_norm(&listener->rvec,&vector_to_sound,&listener->uvec);
fix_sincos(angle_from_ear,&sinang,&cosang);
//mprintf( (0, "volume is %.2f\n", f2fl(*volume) ));
if (Config_channels_reversed) cosang *= -1;
if (GameCfg.ReverseStereo) cosang *= -1;
*pan = (cosang + F1_0)/2;
} else {
*volume = 0;
@ -172,10 +155,9 @@ void digi_play_sample_once( int soundno, fix max_volume )
{
int channel;
#ifdef NEWDEMO
if ( Newdemo_state == ND_STATE_RECORDING )
newdemo_record_sound( soundno );
#endif
soundno = digi_xlat_sound(soundno);
if (soundno < 0 ) return;
@ -191,10 +173,9 @@ void digi_play_sample_once( int soundno, fix max_volume )
void digi_play_sample( int soundno, fix max_volume )
{
#ifdef NEWDEMO
if ( Newdemo_state == ND_STATE_RECORDING )
newdemo_record_sound( soundno );
#endif
soundno = digi_xlat_sound(soundno);
if (soundno < 0 ) return;
@ -209,14 +190,13 @@ void digi_play_sample_3d( int soundno, int angle, int volume, int no_dups )
no_dups = 1;
#ifdef NEWDEMO
if ( Newdemo_state == ND_STATE_RECORDING ) {
if ( no_dups )
newdemo_record_sound_3d_once( soundno, angle, volume );
else
newdemo_record_sound_3d( soundno, angle, volume );
}
#endif
soundno = digi_xlat_sound(soundno);
if (soundno < 0 ) return;
@ -330,7 +310,7 @@ void digi_start_sound_object(int i)
// -- MK, 2/22/96 -- newdemo_record_sound_3d_once( digi_unxlat_sound(SoundObjects[i].soundnum), SoundObjects[i].pan, SoundObjects[i].volume );
// only use up to half the sound channels for "permanent" sounts
if ((SoundObjects[i].flags & SOF_PERMANENT) && (N_active_sound_objects >= max(1, digi_get_max_channels() / 4)))
if ((SoundObjects[i].flags & SOF_PERMANENT) && (N_active_sound_objects >= max(1, digi_max_channels / 4)))
return;
// start the sample playing
@ -376,18 +356,15 @@ int digi_link_sound_to_object3( int org_soundnum, short objnum, int forever, fix
return -1;
}
#ifdef NEWDEMO
if ( Newdemo_state == ND_STATE_RECORDING ) {
newdemo_record_link_sound_to_object3( org_soundnum, objnum, max_volume, max_distance, loop_start, loop_end );
}
#endif
for (i=0; i<MAX_SOUND_OBJECTS; i++ )
if (SoundObjects[i].flags==0)
break;
if (i==MAX_SOUND_OBJECTS) {
mprintf((1, "Too many sound objects!\n" ));
return -1;
}
@ -472,7 +449,6 @@ int digi_link_sound_to_pos2( int org_soundnum, short segnum, short sidenum, vms_
break;
if (i==MAX_SOUND_OBJECTS) {
mprintf((1, "Too many sound objects!\n" ));
return -1;
}
@ -545,11 +521,6 @@ void digi_kill_sound_linked_to_segment( int segnum, int sidenum, int soundnum )
}
}
}
// If this assert happens, it means that there were 2 sounds
// that got deleted. Weird, get John.
if ( killed > 1 ) {
mprintf( (1, "ERROR: More than 1 sounds were deleted from seg %d\n", segnum ));
}
}
void digi_kill_sound_linked_to_object( int objnum )
@ -559,11 +530,9 @@ void digi_kill_sound_linked_to_object( int objnum )
killed = 0;
#ifdef NEWDEMO
if ( Newdemo_state == ND_STATE_RECORDING ) {
newdemo_record_kill_sound_linked_to_object( objnum );
}
#endif
for (i=0; i<MAX_SOUND_OBJECTS; i++ ) {
if ( (SoundObjects[i].flags & SOF_USED) && (SoundObjects[i].flags & SOF_LINK_TO_OBJ ) ) {
@ -578,12 +547,6 @@ void digi_kill_sound_linked_to_object( int objnum )
}
}
}
// If this assert happens, it means that there were 2 sounds
// that got deleted. Weird, get John.
if ( killed > 1 ) {
mprintf( (1, "ERROR: More than 1 sounds were deleted from object %d\n", objnum ));
}
}
// John's new function, 2/22/96.
@ -804,7 +767,6 @@ int verify_sound_channel_free( int channel )
for (i=0; i<MAX_SOUND_OBJECTS; i++ ) {
if ( SoundObjects[i].flags & SOF_USED ) {
if ( SoundObjects[i].channel == channel ) {
mprintf(( 0, "ERROR STARTING SOUND CHANNEL ON USED SLOT!!\n" ));
Int3(); // Get John!
}
}
@ -825,9 +787,6 @@ void digi_sound_debug()
n_active_sound_objs++;
}
}
mprintf_at(( 0, 0, 0, "DIGI: Active Sound Objects: %d,%d/%d (%d max) \n", n_active_sound_objs,N_active_sound_objects, n_sound_objs, MAX_SOUND_OBJECTS ));
mprintf_at(( 0, 1, 0, "DIGI: Looping sound: %s, snd=%d, vol=%d, ch=%d \n", (digi_looping_sound>-1?"ON":"OFF"), digi_looping_sound, digi_looping_volume, digi_looping_channel ));
digi_debug();
}
#endif
@ -874,10 +833,6 @@ void SoundQ_process()
SoundQ_end();
}
if ( SoundQ_num > 0 ) {
mprintf(( 0, "SQ:%d ", SoundQ_num ));
}
while ( SoundQ_head != SoundQ_tail ) {
sound_q * q = &SoundQ[SoundQ_head];
@ -912,8 +867,6 @@ void digi_start_sound_queued( short soundnum, fix volume )
SoundQ[SoundQ_tail].soundnum = soundnum;
SoundQ_num++;
SoundQ_tail = i;
} else {
mprintf(( 0, "Sound Q full!\n" ));
}
// Try to start it!

View File

@ -1,4 +1,3 @@
/* $Id: dumpmine.c,v 1.1.1.1 2006/03/17 19:54:55 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -24,17 +23,13 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include <conf.h>
#endif
#ifdef RCS
static char rcsid[] = "$Id: dumpmine.c,v 1.1.1.1 2006/03/17 19:54:55 zicodxx Exp $";
#endif
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <errno.h>
#include "pstypes.h"
#include "mono.h"
#include "console.h"
#include "key.h"
#include "gr.h"
#include "palette.h"
@ -105,7 +100,7 @@ void err_printf(FILE *my_file, char * format, ... )
vsprintf(message,format,args);
va_end(args);
mprintf((1, "%s", message));
con_printf(CON_CRITICAL, "%s", message);
fprintf(my_file, "%s", message);
Errors_in_mine++;
}
@ -119,7 +114,7 @@ void warning_printf(FILE *my_file, char * format, ... )
vsprintf(message,format,args);
va_end(args);
mprintf((0, "%s", message));
con_printf(CON_URGENT, "%s", message);
fprintf(my_file, "%s", message);
}
@ -554,8 +549,6 @@ void write_game_text_file(char *filename)
Errors_in_mine = 0;
// mprintf((0, "Writing text file for mine [%s]\n", filename));
namelen = strlen(filename);
Assert (namelen > 4);
@ -565,10 +558,7 @@ void write_game_text_file(char *filename)
strcpy(my_filename, filename);
strcpy( &my_filename[namelen-4], ".txm");
// mprintf((0, "Writing text file [%s]\n", my_filename));
my_file = fopen( my_filename, "wt" );
// -- mprintf((1, "Fileno = %i\n", fileno(my_file)));
if (!my_file) {
char ErrorMessage[200];
@ -615,7 +605,6 @@ void write_game_text_file(char *filename)
{ int r;
r = fclose(my_file);
mprintf((1, "Close value = %i\n", r));
if (r)
Int3();
}
@ -786,7 +775,6 @@ void determine_used_textures_level(int load_level_flag, int shareware_flag, int
for (i=0; i<po->n_textures; i++) {
int tli = ObjBitmaps[ObjBitmapPtrs[po->first_texture+i]].index;
// -- mprintf((0, "%s ", AllBitmaps[ObjBitmaps[ObjBitmapPtrs[po->first_texture+i]].index].name));
if ((tli < MAX_BITMAP_FILES) && (tli >= 0)) {
tmap_buf[tli]++;
@ -1025,7 +1013,6 @@ void say_totals_all(void)
FILE *my_file;
my_file = fopen( "levels.all", "wt" );
// -- mprintf((1, "Fileno = %i\n", fileno(my_file)));
if (!my_file) {
char ErrorMessage[200];
@ -1040,25 +1027,11 @@ void say_totals_all(void)
}
for (i=First_dump_level; i<=Last_dump_level; i++) {
mprintf((0, "Level %i\n", i+1));
load_level(Adam_level_names[i]);
say_totals(my_file, Adam_level_names[i]);
}
//--05/17/95-- for (i=0; i<NUM_SHAREWARE_LEVELS; i++) {
//--05/17/95-- mprintf((0, "Level %i\n", i+1));
//--05/17/95-- load_level(Shareware_level_names[i]);
//--05/17/95-- say_totals(my_file, Shareware_level_names[i]);
//--05/17/95-- }
//--05/17/95--
//--05/17/95-- for (i=0; i<NUM_REGISTERED_LEVELS; i++) {
//--05/17/95-- mprintf((0, "Level %i\n", i+1+NUM_SHAREWARE_LEVELS));
//--05/17/95-- load_level(Registered_level_names[i]);
//--05/17/95-- say_totals(my_file, Registered_level_names[i]);
//--05/17/95-- }
fclose(my_file);
}
void dump_used_textures_level(FILE *my_file, int level_num)
@ -1100,7 +1073,6 @@ void dump_used_textures_all(void)
say_totals_all();
my_file = fopen( "textures.dmp", "wt" );
// -- mprintf((1, "Fileno = %i\n", fileno(my_file)));
if (!my_file) {
char ErrorMessage[200];

View File

@ -1,4 +1,3 @@
/* $Id: autosave.c,v 1.1.1.1 2006/03/17 19:58:31 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -19,10 +18,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*
*/
#ifdef RCS
static char rcsid[] = "$Id: autosave.c,v 1.1.1.1 2006/03/17 19:58:31 zicodxx Exp $";
#endif
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
@ -32,16 +27,12 @@ static char rcsid[] = "$Id: autosave.c,v 1.1.1.1 2006/03/17 19:58:31 zicodxx Exp
#include <stdarg.h>
#include <math.h>
#include <string.h>
#ifdef __MSDOS__
#include <process.h>
#endif
#include <time.h>
#include "error.h"
#include "inferno.h"
#include "editor.h"
#include "mono.h"
#include "u_mem.h"
#include "ui.h"
@ -110,7 +101,6 @@ void autosave_mine(char *name) {
ext = strstr(savename, ".MIN");
sprintf( ext, ".M%d", Autosave_count );
//mprintf( 0, "Autosave: %s\n", savename );
med_save_mine( savename );
Autosave_count++;
if (undo_count > 0) undo_count--;
@ -206,38 +196,5 @@ void TimedAutosave(char *name)
int undo( void ) {
Int3();
return 2;
//@@ char *loadname, *ext;
//@@ if (undo_count == 0) original = Autosave_count;
//@@
//@@ if (!Autosave_flag)
//@@ return 2;
//@@
//@@ if (Autosave_numfiles > 1) {
//@@
//@@ MALLOC(loadname, char, PATH_MAX);
//@@
//@@ strcpy ( loadname, mine_filename );
//@@ strupr( loadname );
//@@ if ( !strcmp(loadname, "*.MIN") ) strcpy(loadname, "TEMP.MIN");
//@@
//@@ undo_count++;
//@@ Autosave_count = original - undo_count;
//@@ if (Autosave_count < 0) Autosave_count = Autosave_count+10;
//@@ Autosave_numfiles--;
//@@ //mprintf(0, "u=%d a=%d o=%d num=%d\n", undo_count, Autosave_count, original, Autosave_numfiles);
//@@
//@@ ext = strstr(loadname, ".MIN");
//@@ if (Autosave_count == 0) sprintf( ext, ".M9" );
//@@ else sprintf( ext, ".M%d", Autosave_count-1 );
//@@ //mprintf( 0, "Loading: %s\n", loadname );
//@@ med_load_mine( loadname );
//@@
//@@ d_free(loadname);
//@@ return 0;
//@@ }
//@@ else return 1;
//@@ //diagnostic_message("Can't undo\n");
}

View File

@ -1,4 +1,3 @@
/* $Id: centers.c,v 1.1.1.1 2006/03/17 19:58:22 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -18,10 +17,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*
*/
#ifdef RCS
static char rcsid[] = "$Id: centers.c,v 1.1.1.1 2006/03/17 19:58:22 zicodxx Exp $";
#endif
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
@ -36,11 +31,9 @@ static char rcsid[] = "$Id: centers.c,v 1.1.1.1 2006/03/17 19:58:22 zicodxx Exp
#include "inferno.h"
#include "segment.h"
#include "editor.h"
#include "timer.h"
#include "objpage.h"
#include "fix.h"
#include "mono.h"
#include "error.h"
#include "kdefs.h"
#include "object.h"
@ -144,8 +137,6 @@ void do_centers_window()
Assert(Curseg2p->special < MAX_CENTER_TYPES);
ui_radio_set_value(CenterFlag[Curseg2p->special], 1);
mprintf((0, "Curseg2p->matcen_num = %i\n", Curseg2p->matcen_num));
// Read materialization center robot bit flags
for (i = 0; i < 2; i++)
{
@ -192,13 +183,11 @@ void do_centers_window()
if (!(robot_flags & (1 << robot_index)))
{
robot_flags |= (1 << robot_index);
mprintf((0, "Segment %i, matcen = %i, robot_flags[%d] = %d\n", Cursegp - Segments, Curseg2p->matcen_num, i, robot_flags));
}
}
else if (robot_flags & 1 << robot_index)
{
robot_flags &= ~(1 << robot_index);
mprintf((0, "Segment %i, matcen = %i, robot_flags[%d] = %d\n", Cursegp - Segments, Curseg2p->matcen_num, i, robot_flags));
}
}

View File

@ -1,4 +1,3 @@
/* $Id: curves.c,v 1.1.1.1 2006/03/17 19:58:22 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -18,10 +17,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*
*/
#ifdef RCS
static char rcsid[] = "$Id: curves.c,v 1.1.1.1 2006/03/17 19:58:22 zicodxx Exp $";
#endif
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
@ -32,19 +27,13 @@ static char rcsid[] = "$Id: curves.c,v 1.1.1.1 2006/03/17 19:58:22 zicodxx Exp $
#include <string.h>
#include <ctype.h>
#include <stdarg.h>
#ifdef __MSDOS__
#include <conio.h>
#include <dos.h>
#endif
#include "inferno.h"
#include "mono.h"
#include "vecmat.h"
#include "gr.h"
#include "key.h"
#include "editor.h"
#include "gameseg.h"
#include "console.h"
#define ONE_OVER_SQRT2 F1_0 * 0.707106781
#define CURVE_RIGHT 1
#define CURVE_UP 2
@ -84,7 +73,7 @@ vms_vector evaluate_curve(vms_equation *coeffs, int degree, fix t) {
fix t2, t3;
vms_vector coord;
if (degree!=3) printf("ERROR: for Hermite Curves degree must be 3\n");
if (degree!=3) con_printf(CON_CRITICAL," for Hermite Curves degree must be 3\n");
t2 = fixmul(t,t); t3 = fixmul(t2,t);
@ -100,7 +89,7 @@ fix curve_dist(vms_equation *coeffs, int degree, fix t0, vms_vector *p0, fix dis
vms_vector coord;
fix t, diff;
if (degree!=3) printf("ERROR: for Hermite Curves degree must be 3\n");
if (degree!=3) con_printf(CON_CRITICAL," for Hermite Curves degree must be 3\n");
for (t=t0;t<1*F1_0;t+=0.001*F1_0) {
coord = evaluate_curve(coeffs, 3, t);
@ -115,7 +104,7 @@ fix curve_dist(vms_equation *coeffs, int degree, fix t0, vms_vector *p0, fix dis
void curve_dir(vms_equation *coeffs, int degree, fix t0, vms_vector *dir) {
fix t2;
if (degree!=3) printf("ERROR: for Hermite Curves degree must be 3\n");
if (degree!=3) con_printf(CON_CRITICAL," for Hermite Curves degree must be 3\n");
t2 = fixmul(t0,t0);
@ -270,9 +259,6 @@ int generate_curve( fix r1scale, fix r4scale ) {
vec_dir = tdest;
vm_vector_2_matrix(&rotmat2,&vec_dir,NULL,NULL);
// mprintf(0, "[ [%6.2f %6.2f %6.2f]", f2fl(rotmat2.m1), f2fl(rotmat2.m2), f2fl(rotmat2.m3));
// mprintf(0, " [%6.2f %6.2f %6.2f]", f2fl(rotmat2.m4), f2fl(rotmat2.m5), f2fl(rotmat2.m6));
// mprintf(0, " [%6.2f %6.2f %6.2f] ]\n", f2fl(rotmat2.m7), f2fl(rotmat2.m8), f2fl(rotmat2.m9));
med_rotate_segment( Cursegp, &rotmat2 );
prev_point = coord;
@ -298,7 +284,6 @@ int generate_curve( fix r1scale, fix r4scale ) {
if ((uangle != 0) && (rangle != 0)) {
maxscale = CurveNumSegs*F1_0;
// mprintf(0, "Banked Curve Generation.. %f.\n", f2fl(maxscale));
generate_banked_curve(maxscale, coeffs);
}
@ -335,7 +320,6 @@ void generate_banked_curve(fix maxscale, vms_equation coeffs) {
if (uangle >= F1_0 * 1/8) uangle -= F1_0 * 1/4;
if (uangle <= -F1_0 * 1/8) uangle += F1_0 * 1/4;
if (uangle <= -F1_0 * 1/8) uangle += F1_0 * 1/4;
// mprintf(0, "up angle %f\n", f2fl(uangle)*360);
extract_right_vector_from_segment( Cursegp,&b4r4t );
rangle = vm_vec_delta_ang( &b4r4t, &r4t, &r4 );
@ -343,7 +327,6 @@ void generate_banked_curve(fix maxscale, vms_equation coeffs) {
if (rangle >= F1_0/8) rangle -= F1_0/4;
if (rangle <= -F1_0/8) rangle += F1_0/4;
if (rangle <= -F1_0/8) rangle += F1_0/4;
// mprintf(0, "right angle %f\n", f2fl(rangle)*360);
angle = uangle;
if (abs(rangle) < abs(uangle)) angle = rangle;
@ -356,7 +339,6 @@ void generate_banked_curve(fix maxscale, vms_equation coeffs) {
if (maxscale)
scaled_ang = fixdiv(angle,fixmul(maxscale,MAGIC_NUM));
mprintf((0, "scaled angle = %f\n", f2fl(scaled_ang)));
t=0;
tvec = r1save;
@ -381,9 +363,6 @@ void generate_banked_curve(fix maxscale, vms_equation coeffs) {
vm_vec_rotate(&tdest,&vec_dir,&rotmat); // tdest := vec_dir in reference frame of Cursegp
vec_dir = tdest;
vm_vec_ang_2_matrix(&rotmat2,&vec_dir,scaled_ang);
// mprintf((0, "[ [%6.2f %6.2f %6.2f]", f2fl(rotmat2.m1), f2fl(rotmat2.m2), f2fl(rotmat2.m3)));
// mprintf((0, " [%6.2f %6.2f %6.2f]", f2fl(rotmat2.m4), f2fl(rotmat2.m5), f2fl(rotmat2.m6)));
// mprintf((0, " [%6.2f %6.2f %6.2f] ]\n", f2fl(rotmat2.m7), f2fl(rotmat2.m8), f2fl(rotmat2.m9)));
med_rotate_segment( Cursegp, &rotmat2 );
prev_point = coord;
@ -401,7 +380,6 @@ void delete_curve() {
int i;
for (i=0; i<CurveNumSegs; i++) {
// mprintf((0, "[%d] %d\n", i, CurveSegs[i]->segnum ));
if (CurveSegs[i]->segnum != -1)
med_delete_segment(CurveSegs[i]);
}
@ -411,103 +389,7 @@ void delete_curve() {
Curside = OriginalSide;
med_create_new_segment_from_cursegp();
CurveNumSegs = 0;
// mprintf((0, "Num_segments %d\n", Num_segments));
//editor_status("");
//warn_if_concave_segments();
}
/*
void main() {
vms_vector p1;
vms_vector p4;
vms_vector r1;
vms_vector r4;
vms_equation coeffs;
float x, y, z;
vms_vector test, test2, tvec;
fix t, t0;
fix distance, dist;
int key;
key_init();
printf("Enter p1 (x,y,z): ");
scanf("%f %f %f", &x, &y, &z);
p1.x = x*F1_0; p1.y = y*F1_0; p1.z = z*F1_0;
printf("Enter p4 (x,y,z): ");
scanf("%f %f %f", &x, &y, &z);
p4.x = x*F1_0; p4.y = y*F1_0; p4.z = z*F1_0;
printf("Enter r1 <x,y,z>: ");
scanf("%f %f %f", &x, &y, &z);
r1.x = x*F1_0; r1.y = y*F1_0; r1.z = z*F1_0;
printf("Enter r4 <x,y,z>: ");
scanf("%f %f %f", &x, &y, &z);
r4.x = x*F1_0; r4.y = y*F1_0; r4.z = z*F1_0;
create_curve( &p1, &p4, &r1, &r4, &coeffs );
printf("\nQ(t) = ");
printf("x [%6.3f %6.3f %6.3f %6.3f]\n", f2fl(coeffs.n.x3), f2fl(coeffs.n.x2), f2fl(coeffs.n.x1), f2fl(coeffs.n.x0));
printf(" y [%6.3f %6.3f %6.3f %6.3f]\n", f2fl(coeffs.n.y3), f2fl(coeffs.n.y2), f2fl(coeffs.n.y1), f2fl(coeffs.n.y0));
printf(" z [%6.3f %6.3f %6.3f %6.3f]\n", f2fl(coeffs.n.z3), f2fl(coeffs.n.z2), f2fl(coeffs.n.z1), f2fl(coeffs.n.z0));
printf("\nChecking direction vectors.\n");
for (t=0*F1_0;t<1*F1_0;t+=0.1*F1_0) {
curve_dir(&coeffs, 3, t, &test);
printf(" t = %.3f dir = <%6.3f, %6.3f, %6.3f >\n", f2fl(t), f2fl(test.x), f2fl(test.y), f2fl(test.z) );
}
printf("\nChecking distance function.\n");
printf("Enter a distance: ");
scanf("%f", &x);
distance = x*F1_0;
printf("Enter a (0<t<1) value: ");
scanf("%f", &y);
t0 = y*F1_0;
gr_init(15); // 800x600 mode
plot_parametric(&coeffs, 0*F1_0, 1*F1_0, 0.05*F1_0);
test = evaluate_curve(&coeffs, 3, t0);
t = curve_dist(&coeffs, 3, t0, &test, distance);
test2 = evaluate_curve(&coeffs, 3, t);
dist = vm_vec_mag(vm_vec_sub(&tvec, &test, &test2));
if (t != -1*F1_0) {
gr_setcolor(14);
gr_rect( 74+f2fl(test.x), 289-f2fl(test.z), 76+f2fl(test.x), 291-f2fl(test.z) );
gr_rect( 74+f2fl(test.x), 559-f2fl(test.y), 76+f2fl(test.x), 561-f2fl(test.y) );
gr_rect( 474+f2fl(test.z), 559-f2fl(test.y), 476+f2fl(test.z), 561-f2fl(test.y) );
gr_setcolor(13);
gr_rect( 74+f2fl(test2.x), 289-f2fl(test2.z), 76+f2fl(test2.x), 291-f2fl(test2.z) );
gr_rect( 74+f2fl(test2.x), 559-f2fl(test2.y), 76+f2fl(test2.x), 561-f2fl(test2.y) );
gr_rect( 474+f2fl(test2.z), 559-f2fl(test2.y), 476+f2fl(test2.z), 561-f2fl(test2.y) );
}
key = -1;
while (1)
if (key == KEY_ESC) break;
else key = key_getch();
gr_close();
key_close();
if (t == -1*F1_0) {
printf("From t=%.3f to t=1.000, ", f2fl(t0));
printf("two points separated by the distance %.3f\n do not exist on this curve.\n", x);
}
else {
printf("\nThe distance between points at:\n");
printf(" t0 = %.3f ( %6.3f,%6.3f,%6.3f ) and\n", f2fl(t0), f2fl(test.x), f2fl(test.y), f2fl(test.z));
printf(" t = %.3f ( %6.3f,%6.3f,%6.3f ) is:\n", f2fl(t), f2fl(test2.x), f2fl(test2.y), f2fl(test2.z));
printf(" expected: %.3f\n", x);
printf(" actual : %.3f\n", f2fl(dist) );
}
}
*/

View File

@ -1,4 +1,3 @@
/* $Id: editor.h,v 1.1.1.1 2006/03/17 19:58:11 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -424,7 +423,7 @@ extern void assign_default_uvs_to_side(segment *segp,int side);
extern void med_assign_uvs_to_side(segment *con_seg, int con_common_side, segment *base_seg, int base_common_side, int abs_id1, int abs_id2);
// Debug -- show a matrix.
// type: 0 --> mprintf, 1 --> printf
// type: 1 --> printf
// *s = string to display
// *mp = matrix to display
extern void show_matrix(char *s,vms_matrix *mp,int type);

View File

@ -1,4 +1,3 @@
/* $Id: ehostage.c,v 1.1.1.1 2006/03/17 19:58:33 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -18,491 +17,24 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*
*/
#ifdef RCS
static char rcsid[] = "$Id: ehostage.c,v 1.1.1.1 2006/03/17 19:58:33 zicodxx Exp $";
#endif
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
#if 0 // the hostage code was simplified for Descent 2
#include <stdlib.h>
#include <stdio.h>
#ifdef __MSDOS__
#include <conio.h>
#include <dos.h>
#include <direct.h>
#endif
#include <string.h>
#include <math.h>
#include "screens.h"
#include "inferno.h"
#include "segment.h"
#include "editor.h"
#include "timer.h"
#include "objpage.h"
#include "fix.h"
#include "mono.h"
#include "error.h"
#include "kdefs.h"
#include "object.h"
#include "polyobj.h"
#include "game.h"
#include "powerup.h"
#include "ai.h"
#include "hostage.h"
#include "eobject.h"
#include "medwall.h"
#include "eswitch.h"
#include "medrobot.h"
#include "key.h"
#include "bm.h"
#include "sounds.h"
#include "centers.h"
#include "piggy.h"
//-------------------------------------------------------------------------
// Variables for this module...
//-------------------------------------------------------------------------
static UI_WINDOW *MainWindow = NULL;
static UI_GADGET_USERBOX *HostageViewBox;
static UI_GADGET_INPUTBOX *HostageText;
static UI_GADGET_BUTTON *QuitButton;
static int CurrentHostageIndex=-1;
static int LastHostageIndex=-1;
static fix Vclip_animation_time=0; // How long the rescue sequence has been playing
static fix Vclip_playback_speed=0; // Calculated internally. Frames/second of vclip.
static vclip *Vclip_ptr = NULL; // Used for the vclip on monitor
void vclip_play( vclip * vc, fix frame_time )
{
int bitmapnum;
if ( vc == NULL )
return;
if ( vc != Vclip_ptr ) {
// Start new vclip
Vclip_ptr = vc;
Vclip_animation_time = 1;
// Calculate the frame/second of the playback
Vclip_playback_speed = fixdiv(i2f(Vclip_ptr->num_frames),Vclip_ptr->play_time);
}
if ( Vclip_animation_time <= 0 )
return;
// Find next bitmap in the vclip
bitmapnum = f2i(Vclip_animation_time);
// Check if vclip is done playing.
if (bitmapnum >= Vclip_ptr->num_frames) {
Vclip_animation_time = 1; // Restart this vclip
bitmapnum = 0;
}
PIGGY_PAGE_IN( Vclip_ptr->frames[bitmapnum] );
gr_bitmap(0,0,&GameBitmaps[Vclip_ptr->frames[bitmapnum].index] );
Vclip_animation_time += fixmul(frame_time, Vclip_playback_speed );
}
static char HostageMessage[] = " ";
static fix Time;
int SelectPrevHostage() {
int start=0;
do {
CurrentHostageIndex--;
if ( CurrentHostageIndex < 0 ) CurrentHostageIndex = MAX_HOSTAGES-1;
start++;
if ( start > MAX_HOSTAGES ) break;
} while ( !hostage_is_valid( CurrentHostageIndex ) );
if (hostage_is_valid( CurrentHostageIndex ) ) {
Cur_object_index = Hostages[CurrentHostageIndex].objnum;
} else {
CurrentHostageIndex =-1;
}
return CurrentHostageIndex;
}
int SelectNextHostage() {
int start=0;
do {
CurrentHostageIndex++;
if ( CurrentHostageIndex >= MAX_HOSTAGES ) CurrentHostageIndex = 0;
start++;
if ( start > MAX_HOSTAGES ) break;
} while ( !hostage_is_valid( CurrentHostageIndex ) );
if (hostage_is_valid( CurrentHostageIndex ) ) {
Cur_object_index = Hostages[CurrentHostageIndex].objnum;
} else {
CurrentHostageIndex =-1;
}
return CurrentHostageIndex;
}
int SelectClosestHostage() {
int start=0;
while ( !hostage_is_valid( CurrentHostageIndex ) ) {
CurrentHostageIndex++;
if ( CurrentHostageIndex >= MAX_HOSTAGES ) CurrentHostageIndex = 0;
start++;
if ( start > MAX_HOSTAGES ) break;
}
if (hostage_is_valid( CurrentHostageIndex ) ) {
Cur_object_index = Hostages[CurrentHostageIndex].objnum;
} else {
CurrentHostageIndex =-1;
}
return CurrentHostageIndex;
}
int PlaceHostage() {
int ctype,i;
vms_vector cur_object_loc;
//update_due_to_new_segment();
compute_segment_center(&cur_object_loc, Cursegp);
ctype = -1;
for (i=0; i<Num_total_object_types; i++ ) {
if (ObjType[i] == OL_HOSTAGE ) {
ctype = i;
break;
}
}
Assert( ctype != -1 );
if (place_object(Cursegp, &cur_object_loc, ctype )==0) {
Int3(); // Debug below
i=place_object(Cursegp, &cur_object_loc, ctype );
return 1;
}
if (hostage_object_is_valid( Cur_object_index ) ) {
CurrentHostageIndex = Objects[Cur_object_index].id;
} else {
Int3(); // Get John! (Object should be valid)
i=hostage_object_is_valid( Cur_object_index ); // For debugging only
}
return 0;
}
int CompressHostages()
{
hostage_compress_all();
return 0;
}
//@@int SelectPrevVclip() {
//@@ if (!hostage_is_valid( CurrentHostageIndex ) )
//@@ return 0;
//@@
//@@ if ( Hostages[CurrentHostageIndex].type == 0 )
//@@ Hostages[CurrentHostageIndex].type = N_hostage_types-1;
//@@ else
//@@ Hostages[CurrentHostageIndex].type--;
//@@
//@@ if ( Hostages[CurrentHostageIndex].type >= N_hostage_types )
//@@ Hostages[CurrentHostageIndex].type = 0;
//@@
//@@ return 1;
//@@}
//@@
//@@int SelectNextVclip() {
//@@ if (!hostage_is_valid( CurrentHostageIndex ) )
//@@ return 0;
//@@
//@@ Hostages[CurrentHostageIndex].type++;
//@@ if ( Hostages[CurrentHostageIndex].type >= N_hostage_types )
//@@ Hostages[CurrentHostageIndex].type = 0;
//@@
//@@ return 1;
//@@}
int SelectNextFace()
{
int start = Hostages[CurrentHostageIndex].vclip_num;
if (!hostage_is_valid( CurrentHostageIndex ) )
return 0;
do {
Hostages[CurrentHostageIndex].vclip_num++;
if ( Hostages[CurrentHostageIndex].vclip_num >= MAX_HOSTAGES)
Hostages[CurrentHostageIndex].vclip_num = 0;
if (Hostages[CurrentHostageIndex].vclip_num == start)
return 0;
} while (Hostage_face_clip[Hostages[CurrentHostageIndex].vclip_num].num_frames == 0);
return 1;
}
int SelectPrevFace()
{
int start = Hostages[CurrentHostageIndex].vclip_num;
if (!hostage_is_valid( CurrentHostageIndex ) )
return 0;
do {
Hostages[CurrentHostageIndex].vclip_num--;
if ( Hostages[CurrentHostageIndex].vclip_num < 0)
Hostages[CurrentHostageIndex].vclip_num = MAX_HOSTAGES-1;
if (Hostages[CurrentHostageIndex].vclip_num == start)
return 0;
} while (Hostage_face_clip[Hostages[CurrentHostageIndex].vclip_num].num_frames == 0);
return 1;
}
int PlayHostageSound() {
int sound_num;
if (!hostage_is_valid( CurrentHostageIndex ) )
return 0;
sound_num = Hostage_face_clip[Hostages[CurrentHostageIndex].vclip_num].sound_num;
if ( sound_num > -1 ) {
digi_play_sample( sound_num, F1_0 );
}
return 1;
}
//@@int find_next_hostage_sound() {
//@@ int start=0,n;
//@@
//@@ n = Hostages[CurrentHostageIndex].sound_num;
//@@ do {
//@@ n++;
//@@ if ( n < SOUND_HOSTAGE_VOICES ) n = SOUND_HOSTAGE_VOICES+MAX_HOSTAGE_SOUNDS-1;
//@@ if ( n >= SOUND_HOSTAGE_VOICES+MAX_HOSTAGE_SOUNDS ) n = SOUND_HOSTAGE_VOICES;
//@@ start++;
//@@ if ( start > MAX_HOSTAGE_SOUNDS ) break;
//@@ } while ( Sounds[n] == NULL );
//@@
//@@ if ( Sounds[n] == NULL )
//@@ Hostages[CurrentHostageIndex].sound_num = -1;
//@@ else {
//@@ Hostages[CurrentHostageIndex].sound_num = n;
//@@ PlayHostageSound();
//@@ }
//@@ return 1;
//@@}
//@@
//@@int find_prev_hostage_sound() {
//@@ int start=0,n;
//@@
//@@ n = Hostages[CurrentHostageIndex].sound_num;
//@@ do {
//@@ n--;
//@@ if ( n < SOUND_HOSTAGE_VOICES ) n = SOUND_HOSTAGE_VOICES+MAX_HOSTAGE_SOUNDS-1;
//@@ if ( n >= SOUND_HOSTAGE_VOICES+MAX_HOSTAGE_SOUNDS ) n = SOUND_HOSTAGE_VOICES;
//@@ start++;
//@@ if ( start > MAX_HOSTAGE_SOUNDS ) break;
//@@ } while ( Sounds[n] == NULL );
//@@
//@@ if ( Sounds[n] == NULL )
//@@ Hostages[CurrentHostageIndex].sound_num = -1;
//@@ else {
//@@ Hostages[CurrentHostageIndex].sound_num = n;
//@@ PlayHostageSound();
//@@ }
//@@ return 1;
//@@}
#endif // 0
//-------------------------------------------------------------------------
// Called from the editor... does one instance of the hostage dialog box
//-------------------------------------------------------------------------
int do_hostage_dialog()
{
#if 0
int i;
// Only open 1 instance of this window...
if ( MainWindow != NULL ) return 0;
// Close other windows
close_all_windows();
CurrentHostageIndex = 0;
SelectClosestHostage();
// Open a window with a quit button
MainWindow = ui_open_window( TMAPBOX_X+10, TMAPBOX_Y+20, 765-TMAPBOX_X, 545-TMAPBOX_Y, WIN_DIALOG );
QuitButton = ui_add_gadget_button( MainWindow, 20, 222, 48, 40, "Done", NULL );
ui_wprintf_at( MainWindow, 10, 32,"&Message:" );
HostageText = ui_add_gadget_inputbox( MainWindow, 10, 50, HOSTAGE_MESSAGE_LEN, HOSTAGE_MESSAGE_LEN, HostageMessage );
// The little box the hostage vclip will play in.
HostageViewBox = ui_add_gadget_userbox( MainWindow,10, 90+10, 64, 64 );
// A bunch of buttons...
i = 90;
//@@ ui_add_gadget_button( MainWindow,155,i,70, 26, "<< Type", SelectPrevVclip );
//@@ ui_add_gadget_button( MainWindow,155+70,i,70, 26, "Type >>", SelectNextVclip );i += 29;
//@@ ui_add_gadget_button( MainWindow,155,i,70, 26, "<< Sound", find_prev_hostage_sound );
//@@ ui_add_gadget_button( MainWindow,155+70,i,70, 26, "Sound >>", find_next_hostage_sound );i += 29;
ui_add_gadget_button( MainWindow,155,i,70, 26, "<< Face", SelectPrevFace );
ui_add_gadget_button( MainWindow,155+70,i,70, 26, "Face >>", SelectNextFace );i += 29;
ui_add_gadget_button( MainWindow,155,i,140, 26, "Play sound", PlayHostageSound );i += 29;
ui_add_gadget_button( MainWindow,155,i,140, 26, "Next Hostage", SelectNextHostage ); i += 29;
ui_add_gadget_button( MainWindow,155,i,140, 26, "Prev Hostage", SelectPrevHostage ); i += 29;
ui_add_gadget_button( MainWindow,155,i,140, 26, "Compress All", CompressHostages ); i += 29;
ui_add_gadget_button( MainWindow,155,i,140, 26, "Delete", ObjectDelete ); i += 29;
ui_add_gadget_button( MainWindow,155,i,140, 26, "Create New", PlaceHostage ); i += 29;
Time = timer_get_fixed_seconds();
LastHostageIndex = -2; // Set to some dummy value so everything works ok on the first frame.
// if ( CurrentHostageIndex == -1 )
// SelectNextHostage();
#endif
return 1;
}
void hostage_close_window()
{
#if 0
if ( MainWindow!=NULL ) {
ui_close_window( MainWindow );
MainWindow = NULL;
}
#endif
}
void do_hostage_window()
{
#if 0 // redundant
fix DeltaTime, Temp;
if ( MainWindow == NULL ) return;
SelectClosestHostage();
//------------------------------------------------------------
// Call the ui code..
//------------------------------------------------------------
ui_button_any_drawn = 0;
ui_window_do_gadgets(MainWindow);
//------------------------------------------------------------
// If we change objects, we need to reset the ui code for all
// of the radio buttons that control the ai mode. Also makes
// the current AI mode button be flagged as pressed down.
//------------------------------------------------------------
if (LastHostageIndex != CurrentHostageIndex ) {
if ( CurrentHostageIndex > -1 )
strcpy( HostageText->text, Hostages[CurrentHostageIndex].text );
else
strcpy(HostageText->text, " " );
HostageText->position = strlen(HostageText->text);
HostageText->oldposition = HostageText->position;
HostageText->status=1;
HostageText->first_time = 1;
}
//------------------------------------------------------------
// If any of the radio buttons that control the mode are set, then
// update the cooresponding AI state.
//------------------------------------------------------------
if ( CurrentHostageIndex > -1 )
strcpy( Hostages[CurrentHostageIndex].text, HostageText->text );
//------------------------------------------------------------
// A simple frame time counter for spinning the objects...
//------------------------------------------------------------
Temp = timer_get_fixed_seconds();
DeltaTime = Temp - Time;
Time = Temp;
//------------------------------------------------------------
// Redraw the object in the little 64x64 box
//------------------------------------------------------------
if (CurrentHostageIndex > -1 ) {
int vclip_num;
vclip_num = Hostages[CurrentHostageIndex].vclip_num;
Assert(vclip_num != -1);
gr_set_current_canvas( HostageViewBox->canvas );
if ( vclip_num > -1 ) {
vclip_play( &Hostage_face_clip[vclip_num], DeltaTime );
} else {
gr_clear_canvas( CGREY );
}
} else {
// no hostage, so just blank out
gr_set_current_canvas( HostageViewBox->canvas );
gr_clear_canvas( CGREY );
}
//------------------------------------------------------------
// If anything changes in the ui system, redraw all the text that
// identifies this robot.
//------------------------------------------------------------
if (ui_button_any_drawn || (LastHostageIndex != CurrentHostageIndex) ) {
if ( CurrentHostageIndex > -1 ) {
ui_wprintf_at( MainWindow, 10, 15, "Hostage: %d Object: %d", CurrentHostageIndex, Hostages[CurrentHostageIndex].objnum );
//@@ui_wprintf_at( MainWindow, 10, 73, "Type: %d Sound: %d ", Hostages[CurrentHostageIndex].type, Hostages[CurrentHostageIndex].sound_num );
ui_wprintf_at( MainWindow, 10, 73, "Face: %d ", Hostages[CurrentHostageIndex].vclip_num);
} else {
ui_wprintf_at( MainWindow, 10, 15, "Hostage: none " );
//@@ui_wprintf_at( MainWindow, 10, 73, "Type: Sound: " );
ui_wprintf_at( MainWindow, 10, 73, "Face: " );
}
Update_flags |= UF_WORLD_CHANGED;
}
if ( QuitButton->pressed || (last_keypress==KEY_ESC)) {
hostage_close_window();
return;
}
LastHostageIndex = CurrentHostageIndex;
#endif
}

View File

@ -1,4 +1,3 @@
/* $Id: elight.c,v 1.1.1.1 2006/03/17 19:58:18 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -18,35 +17,21 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*
*/
#ifdef RCS
static char rcsid[] = "$Id: elight.c,v 1.1.1.1 2006/03/17 19:58:18 zicodxx Exp $";
#endif
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
#include <stdio.h>
//#include <stdlib.h>
//#include <stdarg.h>
//#include <math.h>
//#include <string.h>
#include "inferno.h"
#include "segment.h"
#include "editor.h"
#include "seguvs.h"
#include "wall.h"
#include "textures.h"
#include "fix.h"
#include "mono.h"
#include "error.h"
#include "kdefs.h"
#include "gameseg.h"
#include "texmap.h"
// -----------------------------------------------------------------------------

View File

@ -1,4 +1,3 @@
/* $Id: eobject.c,v 1.1.1.1 2006/03/17 19:58:41 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -18,10 +17,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*
*/
#ifdef RCS
static char rcsid[] = "$Id: eobject.c,v 1.1.1.1 2006/03/17 19:58:41 zicodxx Exp $";
#endif
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
@ -38,7 +33,6 @@ static char rcsid[] = "$Id: eobject.c,v 1.1.1.1 2006/03/17 19:58:41 zicodxx Exp
#include "objpage.h"
#include "fix.h"
#include "mono.h"
#include "error.h"
#include "kdefs.h"
#include "object.h"
@ -68,14 +62,10 @@ void show_objects_in_segment(segment *sp)
{
short objid;
mprintf((0,"Objects in segment #%i: ",sp-Segments));
objid = sp->objects;
while (objid != -1) {
mprintf((0,"%2i ",objid));
objid = Objects[objid].next;
}
mprintf((0,"\n"));
}
//returns the number of the first object in a segment, skipping the player
@ -267,7 +257,7 @@ int place_object(segment *segp, vms_vector *object_pos, short object_type, short
Cur_object_index = objnum;
//Cur_object_seg = Cursegp;
show_objects_in_segment(Cursegp); //mprintf the objects
show_objects_in_segment(Cursegp);
Update_flags |= UF_WORLD_CHANGED;
@ -401,8 +391,6 @@ int ObjectSelectNextinSegment(void)
if (id != -1)
Cur_object_index = get_next_object(objsegp,Cur_object_index);
//mprintf((0,"Cur_object_index == %i\n", Cur_object_index));
Update_flags |= UF_WORLD_CHANGED;
return 1;
@ -508,8 +496,7 @@ int move_object_within_mine(object * obj, vms_vector *newpos )
obj_relink( obj-Objects, segnum);
obj->pos = *newpos;
return 0;
} //else
//mprintf((0, "Hit wall seg:side = %i:%i\n", hit_info.hit_seg, hit_info.hit_side));
}
}
}
@ -846,47 +833,6 @@ int ObjectIncreaseHeadingBig() {return rotate_object(Cur_object_index, 0, 0, (RO
// t = - ----------------------
// VxFx + VyFy + VzFz
//void print_vec(vms_vector *vec, char *text)
//{
// mprintf((0, "%10s = %9.5f %9.5f %9.5f\n", text, f2fl(vec->x), f2fl(vec->y), f2fl(vec->z)));
//}
//
// void solve(vms_vector *result, vms_vector *E, vms_vector *V, vms_vector *O, vms_vector *F)
// {
// fix t, D;
// vms_vector Fnorm, Vnorm;
// fix num, denom;
// // float test_plane;
//
// print_vec(E, "E");
// print_vec(V, "V");
// print_vec(O, "O");
// print_vec(F, "F");
//
// Fnorm = *F; vm_vec_normalize(&Fnorm);
// Vnorm = *V; vm_vec_normalize(&Vnorm);
//
// D = (fixmul(O->x, Fnorm.x) + fixmul(O->y, Fnorm.y) + fixmul(O->z, Fnorm.z));
// mprintf((0, "D = %9.5f\n", f2fl(D)));
//
// num = fixmul(Fnorm.x, E->x) + fixmul(Fnorm.y, E->y) + fixmul(Fnorm.z, E->z) - D;
// denom = vm_vec_dot(&Vnorm, &Fnorm);
// t = - num/denom;
//
// mprintf((0, "num = %9.5f, denom = %9.5f, t = %9.5f\n", f2fl(num), f2fl(denom), f2fl(t)));
//
// result->x = E->x + fixmul(t, Vnorm.x);
// result->y = E->y + fixmul(t, Vnorm.y);
// result->z = E->z + fixmul(t, Vnorm.z);
//
// print_vec(result, "result");
//
// // test_plane = fixmul(result->x, Fnorm.x) + fixmul(result->y, Fnorm.y) + fixmul(result->z, Fnorm.z) - D;
// // if (abs(test_plane) > .001)
// // printf("OOPS: test_plane = %9.5f\n", test_plane);
// }
void move_object_to_position(int objnum, vms_vector *newpos)
{
object *objp = &Objects[objnum];
@ -894,7 +840,6 @@ void move_object_to_position(int objnum, vms_vector *newpos)
segmasks result = get_seg_masks(newpos, objp->segnum, objp->size, __FILE__, __LINE__);
if (result.facemask == 0) {
//mprintf((0, "Object #%i moved from (%7.3f %7.3f %7.3f) to (%7.3f %7.3f %7.3f)\n", objnum, f2fl(objp->pos.x), f2fl(objp->pos.y), f2fl(objp->pos.z), f2fl(newpos->x), f2fl(newpos->y), f2fl(newpos->z)));
objp->pos = *newpos;
} else {
if (verify_object_seg(&Objects[objnum], newpos)) {
@ -917,7 +862,6 @@ void move_object_to_position(int objnum, vms_vector *newpos)
while (viewer_segnum == -1) {
vms_vector temp_vec;
//mprintf((0, "[towards %7.3f %7.3f %7.3f]\n", f2fl(temp_viewer_obj.pos.x), f2fl(temp_viewer_obj.pos.y), f2fl(temp_viewer_obj.pos.z)));
last_outside_pos = temp_viewer_obj.pos;
vm_vec_avg(&temp_vec, &temp_viewer_obj.pos, newpos);
@ -937,7 +881,6 @@ void move_object_to_position(int objnum, vms_vector *newpos)
vms_vector temp_vec;
//mprintf((0, "[away %7.3f %7.3f %7.3f]\n", f2fl(temp_viewer_obj.pos.x), f2fl(temp_viewer_obj.pos.y), f2fl(temp_viewer_obj.pos.z)));
last_inside_pos = temp_viewer_obj.pos;
vm_vec_avg(&temp_vec, &temp_viewer_obj.pos, &last_outside_pos);
@ -965,15 +908,12 @@ void move_object_to_position(int objnum, vms_vector *newpos)
if (fate == HIT_WALL) {
int new_segnum;
//mprintf((0, "Hit wall seg:side = %i:%i, point = (%7.3f %7.3f %7.3f)\n", hit_info.hit_seg, hit_info.hit_side, f2fl(hit_info.hit_pnt.x), f2fl(hit_info.hit_pnt.y), f2fl(hit_info.hit_pnt.z)));
objp->pos = hit_info.hit_pnt;
new_segnum = find_object_seg(objp);
Assert(new_segnum != -1);
obj_relink(objp-Objects, new_segnum);
//mprintf((0, "Object moved from segment %i to %i\n", old_segnum, objp->segnum));
} else {
editor_status("Attempted to move object out of mine. Object not moved.");
//mprintf((0,"Attempted to move object out of mine. Object not moved."));
}
}
}
@ -1006,8 +946,6 @@ void move_object_to_mouse_click_delta(fix delta_distance)
med_point_2_vec(&_canv_editor_game, &vec_through_screen, xcrd, ycrd);
//mprintf((0, "Mouse click at %i %i, vector = %7.3f %7.3f %7.3f\n", xcrd, ycrd, f2fl(vec_through_screen.x), f2fl(vec_through_screen.y), f2fl(vec_through_screen.z)));
move_object_to_vector(&vec_through_screen, delta_distance);
}

View File

@ -1,4 +1,3 @@
/* $Id: eswitch.c,v 1.1.1.1 2006/03/17 19:58:20 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -18,10 +17,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*
*/
#ifdef RCS
static char rcsid[] = "$Id: eswitch.c,v 1.1.1.1 2006/03/17 19:58:20 zicodxx Exp $";
#endif
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
@ -37,12 +32,9 @@ static char rcsid[] = "$Id: eswitch.c,v 1.1.1.1 2006/03/17 19:58:20 zicodxx Exp
#include "segment.h"
#include "error.h"
#include "gameseg.h"
#include "mono.h"
#include "wall.h"
#include "medwall.h"
#include "screens.h"
#include "textures.h"
#include "texmerge.h"
#include "medrobot.h"
@ -207,9 +199,6 @@ int bind_matcen_to_trigger() {
Triggers[trigger_num].seg[link_num] = Cursegp - Segments;
Triggers[trigger_num].num_links++;
mprintf((0, "seg %d linked to link_num %d\n",
Triggers[trigger_num].seg[link_num], link_num));
editor_status("Matcen linked to trigger");
return 1;
@ -261,9 +250,6 @@ int bind_wall_to_trigger() {
Triggers[trigger_num].side[link_num] = Curside;
Triggers[trigger_num].num_links++;
mprintf((0, "seg %d:side %d linked to link_num %d\n",
Triggers[trigger_num].seg[link_num], Triggers[trigger_num].side[link_num], link_num));
editor_status("Wall linked to trigger");
return 1;
@ -298,7 +284,6 @@ int remove_trigger(segment *seg, short side)
{
if (seg->sides[side].wall_num == -1)
{
mprintf((0, "Can't remove trigger from wall_num -1\n"));
return 0;
}

View File

@ -1,4 +1,3 @@
/* $Id: fixseg.c,v 1.1.1.1 2006/03/17 19:58:31 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -18,10 +17,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*
*/
#ifdef RCS
static char rcsid[] = "$Id: fixseg.c,v 1.1.1.1 2006/03/17 19:58:31 zicodxx Exp $";
#endif
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
@ -30,14 +25,10 @@ static char rcsid[] = "$Id: fixseg.c,v 1.1.1.1 2006/03/17 19:58:31 zicodxx Exp $
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include "mono.h"
#include "key.h"
#include "gr.h"
#include "inferno.h"
#include "segment.h"
//#include "segment2.h"
#include "editor.h"
#include "error.h"
#include "gameseg.h"
@ -55,7 +46,6 @@ void gaussj(fix **a, int n, fix **b, int m)
fix big, dum, pivinv, temp;
if (n > 4) {
mprintf((0,"Error -- array too large in gaussj.\n"));
Int3();
}
@ -74,7 +64,6 @@ void gaussj(fix **a, int n, fix **b, int m)
icol = k;
}
} else if (ipiv[k] > 1) {
mprintf((0,"Error: Singular matrix-1\n"));
Int3();
}
}
@ -99,7 +88,6 @@ void gaussj(fix **a, int n, fix **b, int m)
indxr[i] = irow;
indxc[i] = icol;
if (a[icol][icol] == 0) {
mprintf((0,"Error: Singular matrix-2\n"));
Int3();
}
pivinv = fixdiv(F1_0, a[icol][icol]);

View File

@ -1,4 +1,3 @@
/* $Id: group.c,v 1.1.1.1 2006/03/17 19:58:46 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -18,10 +17,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*
*/
#ifdef RCS
static char rcsid[] = "$Id: group.c,v 1.1.1.1 2006/03/17 19:58:46 zicodxx Exp $";
#endif
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
@ -29,18 +24,15 @@ static char rcsid[] = "$Id: group.c,v 1.1.1.1 2006/03/17 19:58:46 zicodxx Exp $"
#include <stdio.h>
#include <string.h>
#include "mono.h"
#include "gr.h"
#include "nocfile.h"
#include "ui.h"
#include "inferno.h"
#include "segment.h"
#include "editor/editor.h"
#include "error.h"
#include "gamemine.h"
#include "gameseg.h"
#include "bm.h" // For MAX_TEXTURES.
#include "textures.h"
#include "hash.h"
@ -389,7 +381,6 @@ void med_rotate_group(vms_matrix *rotmat, short *group_seglist, int group_size,
while (objnum != -1) {
vms_vector tv, tv1;
mprintf((0, "%2i ", objnum));
vm_vec_sub(&tv1,&Objects[objnum].pos,&rotate_center);
vm_vec_rotate(&tv,&tv1,rotmat);
vm_vec_add(&Objects[objnum].pos, &tv, &rotate_center);
@ -423,7 +414,6 @@ void cgl_aux(segment *segp, short *seglistp, int *num_segs, short *ignore_list,
return;
if ((segp-Segments < 0) || (segp-Segments >= MAX_SEGMENTS)) {
mprintf((0,"Warning -- invalid segment index = %i, max = %i\n",segp-Segments,MAX_SEGMENTS));
Int3();
}
@ -488,7 +478,6 @@ void duplicate_group(sbyte *vertex_ids, short *segment_ids, int num_segments)
if (Objects[objnum].type != OBJ_PLAYER) {
int new_obj_id;
new_obj_id = obj_create_copy(objnum, &Objects[objnum].pos, new_segment_id);
mprintf((0, "Object #%i in segment #%i copied to object #%i, segment #%i: new_obj->segnum = %i\n", objnum, Objects[objnum].segnum, new_obj_id, new_segment_id, Objects[new_obj_id].segnum));
}
objnum = Objects[objnum].next;
}
@ -603,19 +592,6 @@ int med_copy_group(int delta_flag, segment *base_seg, int base_side, segment *gr
in_vertex_list[Segments[GroupList[new_current_group].segments[s]].verts[v]] = 1;
}
// Show which objects are in which segments before group copy.
// for (s=0; s<=Highest_segment_index; s++) {
// int objnum = Segments[s].objects;
// mprintf((0, "Before: Segment #%2i contains objects ", s));
// while (objnum != -1) {
// mprintf((0, "%2i ",objnum));
// objnum = Objects[objnum].next;
// }
// mprintf((0, "\n"));
// }
// Given a list of vertex indices (indicated by !0 in in_vertex_list) and segment indices (in list GroupList[current_group].segments, there
// are GroupList[current_group].num_segments segments), copy all segments and vertices
// Return updated lists of vertices and segments in in_vertex_list and GroupList[current_group].segments
@ -634,12 +610,10 @@ int med_copy_group(int delta_flag, segment *base_seg, int base_side, segment *gr
// Breaking connections between segments in the current group and segments not in the group.
for (s=0; s<GroupList[new_current_group].num_segments; s++) {
mprintf((0, "[%3i %3i] ", GroupList[new_current_group].segments[s], GroupList[current_group].segments[s]));
segp = &Segments[GroupList[new_current_group].segments[s]];
for (c=0; c<MAX_SIDES_PER_SEGMENT; c++)
if (IS_CHILD(segp->children[c])) {
if (!in_group(segp->children[c], new_current_group)) {
mprintf((0, "2: Breaking connection at seg:side = %i:%i\n", segp-Segments, c));
segp->children[c] = -1;
validate_segment_side(segp,c); // we have converted a connection to a side so validate the segment
}
@ -818,15 +792,11 @@ int med_move_group(int delta_flag, segment *base_seg, int base_side, segment *gr
int segnum = GroupList[current_group].segments[s];
int objnum = Segments[segnum].objects;
// mprintf((0, "Translating objects in segment #%2i by [%7.3f %7.3f %7.3f]: ", segnum, f2fl(srcv.x), f2fl(srcv.y), f2fl(srcv.z)));
while (objnum != -1) {
mprintf((0, "%2i ", objnum));
vm_vec_sub2(&Objects[objnum].pos, &srcv);
objnum = Objects[objnum].next;
}
}
// mprintf((0, "\n"));
// Now, rotate segments in group so orientation of group_seg is same as base_seg.
med_create_group_rotation_matrix(&rotmat, delta_flag, group_seg, group_side, base_seg, base_side, orient_matrix, orientation);
@ -967,14 +937,11 @@ void delete_segment_from_group(int segment_num, int group_num)
break;
}
//mprintf((0, "segment_num=%d delseg_index=%d\n", segment_num, del_seg_index));
if (IS_CHILD(del_seg_index)) {
for (g=del_seg_index;g<GroupList[group_num].num_segments-1;g++) {
GroupList[group_num].segments[g] = GroupList[group_num].segments[g+1];
}
GroupList[group_num].num_segments--;
//mprintf((0, "num_segments=%d\n\n", GroupList[group_num].num_segments));
Segments[segment_num].group = -1;
}
@ -1021,7 +988,6 @@ int rotate_segment_new(vms_angvec *pbh)
child_save = Cursegp->children[newseg_side]; // save connection we are about to sever
Cursegp->children[newseg_side] = -1; // sever connection
create_group_list(Cursegp, GroupList[ROT_GROUP].segments, &GroupList[ROT_GROUP].num_segments, Selected_segs, 0); // create list of segments in group
//mprintf((0, "NumSegs = %d\n", GroupList[ROT_GROUP].num_segments));
Cursegp->children[newseg_side] = child_save; // restore severed connection
GroupList[ROT_GROUP].segments[0] = newseg;
@ -1340,7 +1306,6 @@ int med_load_group( char *filename, short *vertex_ids, short *segment_ids, int *
if (cfread( &tvert, sizeof(tvert),1,LoadFile )!=1)
Error( "Error reading tvert in group.c" );
vertex_ids[i] = med_create_duplicate_vertex( &tvert );
//mprintf((0, "vertex %d created from original %d\n", vertex_ids[i], i));
}
}
@ -1420,8 +1385,6 @@ int med_load_group( char *filename, short *vertex_ids, short *segment_ids, int *
for (i=0;i<NumTextures;i++) {
temptr = strchr(TmapInfo[i].filename, '.');
if (temptr) *temptr = '\0';
// mprintf( (0, "Texture %d is '%s'\n", i, TmapInfo[i].filename ));
// key_getch();
hashtable_insert( &ht, TmapInfo[i].filename, i );
}
@ -1526,7 +1489,6 @@ int SaveGroup()
GroupList[current_group].vertices[v++] = i;
}
GroupList[current_group].num_vertices = v;
//mprintf((0, "Saving %d vertices, %d segments\n", GroupList[current_group].num_vertices, GroupList[current_group].num_segments));
med_save_group("TEMP.GRP", GroupList[current_group].vertices, GroupList[current_group].segments,
GroupList[current_group].num_vertices, GroupList[current_group].num_segments);
if (ui_get_filename( group_filename, "*.GRP", "SAVE GROUP" ))
@ -1564,7 +1526,6 @@ int LoadGroup()
checkforgrpext(group_filename);
med_load_group(group_filename, GroupList[current_group].vertices, GroupList[current_group].segments,
&GroupList[current_group].num_vertices, &GroupList[current_group].num_segments) ;
//mprintf((0, "Loaded %d vertices, %d segments\n", GroupList[current_group].num_vertices, GroupList[current_group].num_segments));
if (!med_move_group(0, Cursegp, Curside, Groupsegp[current_group], Groupside[current_group], &vmd_identity_matrix, 0)) {
autosave_mine(mine_filename);
@ -1811,26 +1772,10 @@ int SubtractFromGroup(void)
current_group = (current_group + 1) % MAX_GROUPS;
// if (num_groups < MAX_GROUPS) {
// current_group = num_groups;
// num_groups++;
// } else
// current_group = 0;
// mprintf((0, "Old group: "));
// for (s=0; s<GroupList[original_group].num_segments; s++)
// mprintf((0, "%3i ", GroupList[original_group].segments[s]));
// mprintf((0, "\n"));
// Create a list of segments to copy.
GroupList[current_group].num_segments = 0;
create_group_list(Markedsegp, GroupList[current_group].segments, &GroupList[current_group].num_segments, Selected_segs, N_selected_segs);
// mprintf((0, "New group: "));
// for (s=0; s<GroupList[current_group].num_segments; s++)
// mprintf((0, "%3i ", GroupList[current_group].segments[s]));
// mprintf((0, "\n"));
// Now, scan the two groups, forming a group which consists of only those segments common to the two groups.
gp = GroupList[current_group].segments;
cur_num_segs = GroupList[current_group].num_segments;
@ -1853,13 +1798,10 @@ int SubtractFromGroup(void)
// Go through mine and seg group number of all segments which are in group
// All segments which were subtracted from group get group set to -1.
mprintf((0, "In segments: "));
for (s=0; s<cur_num_segs; s++) {
Segments[GroupList[current_group].segments[s]].group = current_group;
mprintf((0, "%2i ", GroupList[current_group].segments[s]));
}
mprintf((0, "\nRemoved segments: "));
for (s=0; s<=Highest_segment_index; s++) {
int t;
if (Segments[s].group == current_group) {
@ -1868,16 +1810,10 @@ int SubtractFromGroup(void)
break;
if (s == cur_num_segs) {
Segments[s].group = -1;
mprintf((0, "%2i ", s));
}
}
}
// mprintf((0, "Combined group: "));
// for (s=0; s<GroupList[current_group].num_segments; s++)
// mprintf((0, "%3i ", GroupList[current_group].segments[s]));
// mprintf((0, "\n\n"));
GroupList[current_group].num_segments = cur_num_segs;
// Replace Marked segment with Group Segment.
@ -1953,8 +1889,6 @@ int DeleteGroup( void )
if (num_groups==0) return 0;
//mprintf((0, "num_segments = %d\n", GroupList[current_group].num_segments));
numsegs = GroupList[current_group].num_segments;
for (i=0; i<numsegs; i++) {

View File

@ -1,4 +1,3 @@
/* $Id: info.c,v 1.1.1.1 2006/03/17 19:58:31 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -18,10 +17,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*
*/
#ifdef RCS
static char rcsid[] = "$Id: info.c,v 1.1.1.1 2006/03/17 19:58:31 zicodxx Exp $";
#endif
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
@ -29,27 +24,21 @@ static char rcsid[] = "$Id: info.c,v 1.1.1.1 2006/03/17 19:58:31 zicodxx Exp $";
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef DO_MEMINFO
#include <i86.h>
#include <malloc.h>
#endif
#include "inferno.h"
#include "segment.h"
#include "gr.h"
#include "ui.h"
#include "editor.h"
#include "mono.h"
#include "error.h"
#include "textures.h"
#include "object.h"
#include "ai.h"
#include "texpage.h" // Textue selection paging stuff
#include "objpage.h" // Object selection paging stuff
#include "wall.h"
#include "switch.h"

View File

@ -1,4 +1,3 @@
/* $Id: kbuild.c,v 1.1.1.1 2006/03/17 19:58:23 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -18,21 +17,14 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*
*/
#ifdef RCS
static char rcsid[] = "$Id: kbuild.c,v 1.1.1.1 2006/03/17 19:58:23 zicodxx Exp $";
#endif
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
#include <string.h>
#include "inferno.h"
#include "editor/editor.h"
#include "gameseg.h"
#include "gamesave.h"
#include "mono.h"
// ---------- Create a bridge segment between current segment/side and marked segment/side ----------
int CreateBridge()

View File

@ -1,4 +1,3 @@
/* $Id: kfuncs.c,v 1.5 2006/03/05 12:19:57 chris Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -18,16 +17,11 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*
*/
#ifdef RCS
static char rcsid[] = "$Id: kfuncs.c,v 1.5 2006/03/05 12:19:57 chris Exp $";
#endif
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
#include <stdlib.h>
#include "inferno.h"
#include "func.h"
#include "editor/kdefs.h"
@ -35,7 +29,6 @@ static char rcsid[] = "$Id: kfuncs.c,v 1.5 2006/03/05 12:19:57 chris Exp $";
#include "editor/editor.h"
#include "error.h"
#include "slew.h"
#include "mono.h"
#include "gamesave.h"
#include "editor/eobject.h"
#include "editor/medwall.h"
@ -60,12 +53,6 @@ extern void do_replacements_all(void);
int Test1()
{
// { int i;
// for (i=Highest_segment_index+1; i<MAX_SEGMENTS; i++)
// Segments[i].segnum = -1;
// }
mprintf((0, "Initializing replacement list.\n"));
init_replacements();
return 0;
@ -73,10 +60,6 @@ int Test1()
int Test2()
{
// mprintf((0, "\nCalling check_for_overlapping_segments.\n"));
// check_for_overlapping_segments();
mprintf((0, "Going to do texture replacements.\n"));
do_replacements();
return 0;
@ -93,7 +76,6 @@ int Test3()
// If you don't want to do this, set eip to the return statement
// and continue.
mprintf((0, "Going to do texture replacements.\n"));
do_replacements_all();
return 0;

View File

@ -1,4 +1,3 @@
/* $Id: kmine.c,v 1.1.1.1 2006/03/17 19:58:18 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -18,10 +17,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*
*/
#ifdef RCS
static char rcsid[] = "$Id: kmine.c,v 1.1.1.1 2006/03/17 19:58:18 zicodxx Exp $";
#endif
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
@ -29,23 +24,18 @@ static char rcsid[] = "$Id: kmine.c,v 1.1.1.1 2006/03/17 19:58:18 zicodxx Exp $"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "error.h"
#include "strutil.h"
#include "nocfile.h"
#include "inferno.h"
#include "editor.h"
#include "ui.h"
#include "texpage.h" // For texpage_goto_first
#include "segment.h"
#include "mono.h"
#include "kdefs.h"
#include "info.h"
#include "game.h"
#include "gameseq.h"
#include "object.h"
#define MINESAVE_CRIPPLED 0
@ -193,57 +183,6 @@ int med_load_situation(char * filename)
Int3();
return 1;
//@@ CFILE * LoadFile;
//@@ char mine_name[MAX_NAME_LENGTH];
//@@ char dir_name[_MAX_DIR];
//@@ char mine_path[MAX_NAME_LENGTH];
//@@ vms_vector pos;
//@@ fix mat[9];
//@@
//@@ LoadFile = cfopen( filename, "rt" );
//@@ if (!LoadFile) {
//@@ char ErrorMessage[200];
//@@
//@@ sprintf( ErrorMessage, "ERROR: Unable to open %s\n", filename );
//@@ MessageBox( -2, -2, 1, ErrorMessage, "Ok" );
//@@ return 1;
//@@ }
//@@
//@@ fscanf(LoadFile, "%s", &mine_name);
//@@ mprintf((0, "Mine name = [%s]\n", mine_name));
//@@
//@@ _splitpath(filename,mine_path,dir_name,NULL,NULL);
//@@ strcat(mine_path,dir_name);
//@@ strcat(mine_path,mine_name);
//@@
//@@ mprintf((0, "Mine path = [%s]\n", mine_path));
//@@
//@@ med_load_mine(mine_path);
//@@
//@@ fscanf(LoadFile, "%x %x %x", &pos.x, &pos.y, &pos.z);
//@@ mprintf((0, "Load Position = %8x %8x %8x\n", pos.x, pos.y, pos.z));
//@@ mprintf((0, "\n"));
//@@
//@@ fscanf(LoadFile, "%x %x %x", &mat[0], &mat[1], &mat[2]);
//@@ mprintf((0, "%8x %8x %8x\n", mat[0], mat[1], mat[2]));
//@@
//@@ fscanf(LoadFile, "%x %x %x", &mat[3], &mat[4], &mat[5]);
//@@ mprintf((0, "%8x %8x %8x\n", mat[3], mat[4], mat[5]));
//@@
//@@ fscanf(LoadFile, "%x %x %x", &mat[6], &mat[7], &mat[8]);
//@@ mprintf((0, "%8x %8x %8x\n", mat[6], mat[7], mat[8]));
//@@ mprintf((0, "\n"));
//@@
//@@ fscanf(LoadFile, "%i\n", &ConsoleObject->segnum);
//@@
//@@ cfclose( LoadFile );
//@@
//@@ ConsoleObject->pos = pos;
//@@ ConsoleObject->orient.m1 = mat[0]; ConsoleObject->orient.m2 = mat[1]; ConsoleObject->orient.m3 = mat[2];
//@@ ConsoleObject->orient.m4 = mat[3]; ConsoleObject->orient.m5 = mat[4]; ConsoleObject->orient.m6 = mat[5];
//@@ ConsoleObject->orient.m7 = mat[6]; ConsoleObject->orient.m8 = mat[7]; ConsoleObject->orient.m9 = mat[8];
//@@
//@@ return 0;
}
// -----------------------------------------------------------------------------
@ -276,14 +215,6 @@ int med_save_situation(char * filename)
fprintf(SaveFile, "%8x %8x %8x\n",(unsigned int) ConsoleObject->orient.fvec.x,(unsigned int) ConsoleObject->orient.fvec.y,(unsigned int) ConsoleObject->orient.fvec.z);
fprintf(SaveFile, "%i\n", ConsoleObject->segnum);
mprintf((0, "Save Position = %8x %8x %8x\n", ConsoleObject->pos.x, ConsoleObject->pos.y, ConsoleObject->pos.z));
mprintf((0, "\n"));
mprintf((0, "%8x %8x %8x\n", ConsoleObject->orient.rvec.x, ConsoleObject->orient.rvec.y, ConsoleObject->orient.rvec.z));
mprintf((0, "%8x %8x %8x\n", ConsoleObject->orient.uvec.x, ConsoleObject->orient.uvec.y, ConsoleObject->orient.uvec.z));
mprintf((0, "%8x %8x %8x\n", ConsoleObject->orient.fvec.x, ConsoleObject->orient.fvec.y, ConsoleObject->orient.fvec.z));
mprintf((0, "\n"));
cfclose( SaveFile);
return 1;
@ -295,7 +226,6 @@ int SaveSituation(void)
if (ui_get_filename( sit_filename, "*.SIT", "Save Situation" )) {
set_extension(sit_filename, "MIN");
if (med_save_mine(sit_filename)) {
mprintf((0, "Unable to save mine in SaveSituation.\n"));
return 0;
}

View File

@ -1,4 +1,3 @@
/* $Id: ksegsize.c,v 1.1.1.1 2006/03/17 19:58:46 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -18,19 +17,12 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*
*/
#ifdef RCS
static char rcsid[] = "$Id: ksegsize.c,v 1.1.1.1 2006/03/17 19:58:46 zicodxx Exp $";
#endif
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
#include <stdlib.h>
#include "inferno.h"
#include "editor.h"
#include "mono.h"
#include "error.h"
#include "segment.h"
#include "gameseg.h"
@ -68,7 +60,6 @@ void validate_modified_segments(void)
if (modified_segments[v]) {
int s;
// mprintf(0, "Validating segment #%04i\n", v);
validate_segment(&Segments[v]);
for (s=0; s<MAX_SIDES_PER_SEGMENT; s++) {
Num_tilings = 1;
@ -228,7 +219,6 @@ int segsize_common(int dimension, fix amount)
if (Degenerate_segment_found) {
Degenerate_segment_found = 0;
// mprintf(0, "Applying scale would create degenerate segments. Aborting scale.\n");
editor_status("Applying scale would create degenerate segments. Aborting scale.");
med_scale_segment_new(Cursegp, dimension, -amount);
return 1;

View File

@ -1,4 +1,3 @@
/* $Id: ktmap.c,v 1.1.1.1 2006/03/17 19:58:21 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -18,19 +17,12 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*
*/
#ifdef RCS
static char rcsid[] = "$Id: ktmap.c,v 1.1.1.1 2006/03/17 19:58:21 zicodxx Exp $";
#endif
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
#include <string.h>
#include "inferno.h"
#include "editor.h"
#include "mono.h"
#include "kdefs.h"
// Assign CurrentTexture to Curside in *Cursegp

View File

@ -1,4 +1,3 @@
/* $Id: macro.c,v 1.1.1.1 2006/03/17 19:58:21 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -18,10 +17,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*
*/
#ifdef RCS
static char rcsid[] = "$Id: macro.c,v 1.1.1.1 2006/03/17 19:58:21 zicodxx Exp $";
#endif
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
@ -31,24 +26,19 @@ static char rcsid[] = "$Id: macro.c,v 1.1.1.1 2006/03/17 19:58:21 zicodxx Exp $"
#include <stdarg.h>
#include <math.h>
#include <string.h>
#include "inferno.h"
#include "segment.h"
#include "editor.h"
#include "gr.h"
#include "ui.h"
#include "key.h"
#include "fix.h"
#include "mono.h"
#include "3d.h"
#include "mouse.h"
#include "bm.h"
#include "error.h"
#include "medlisp.h"
#include "kdefs.h"
#include "u_mem.h"
#define MAX_NUM_EVENTS 10000

View File

@ -1,4 +1,3 @@
/* $Id: med.c,v 1.10 2006/03/05 12:19:57 chris Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -33,28 +32,17 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include <string.h>
#include <time.h>
#ifdef __MSDOS__
#include <process.h>
#endif
//#define INCLUDE_XLISP
#include "inferno.h"
#include "segment.h"
#include "gr.h"
#include "ui.h"
#include "editor.h"
//#include "gamemine.h"
#include "gamesave.h"
#include "gameseg.h"
#include "key.h"
#include "mono.h"
#include "error.h"
#include "kfuncs.h"
#include "macro.h"
#ifdef INCLUDE_XLISP
#include "medlisp.h"
#endif
@ -72,7 +60,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "wall.h"
#include "info.h"
#include "ai.h"
#include "console.h"
#include "texpage.h" // Textue selection paging stuff
#include "objpage.h" // Object selection paging stuff
@ -295,7 +283,6 @@ int GotoGameScreen()
gamestate_not_restored = 1;
save_level("GAMESAVE.LVL");
editor_status("Gamestate saved.\n");
mprintf((0, "Gamestate saved.\n"));
}
ai_reset_all_paths();
@ -376,8 +363,6 @@ void medkey_init()
void init_editor()
{
minit();
ui_init();
init_med_functions(); // Must be called before medlisp_init
@ -636,7 +621,6 @@ int DosShell()
// gr_set_mode( SM_ORIGINAL );
printf( "\n\nType EXIT to return to Inferno" );
fflush(stdout);
key_close();
@ -981,7 +965,6 @@ int RestoreGameState() {
load_level("GAMESAVE.LVL");
gamestate_not_restored = 0;
mprintf((0, "Gamestate restored.\n"));
editor_status("Gamestate restored.\n");
Update_flags |= UF_WORLD_CHANGED;
@ -1109,8 +1092,6 @@ void editor(void)
}
}
// mprintf((0, "%d ", ui_get_idle_seconds() ));
if ( ui_get_idle_seconds() > COMPRESS_INTERVAL )
{
med_compress_mine();
@ -1396,15 +1377,15 @@ void test_fade(void)
int i,c;
for (c=0; c<256; c++) {
printf("%4i: {%3i %3i %3i} ",c,gr_palette[3*c],gr_palette[3*c+1],gr_palette[3*c+2]);
con_printf(CON_DEBUG,"%4i: {%3i %3i %3i} ",c,gr_palette[3*c],gr_palette[3*c+1],gr_palette[3*c+2]);
for (i=0; i<16; i++) {
int col = gr_fade_table[256*i+c];
printf("[%3i %3i %3i] ",gr_palette[3*col],gr_palette[3*col+1],gr_palette[3*col+2]);
con_printf(CON_DEBUG,"[%3i %3i %3i] ",gr_palette[3*col],gr_palette[3*col+1],gr_palette[3*col+2]);
}
if ( (c%16) == 15)
printf("\n");
printf("\n");
con_printf(CON_DEBUG,"\n");
con_printf(CON_DEBUG,"\n");
}
}
@ -1412,40 +1393,40 @@ void dump_stuff(void)
{
int i,j,prev_color;
printf("Palette:\n");
con_printf(CON_DEBUG,"Palette:\n");
for (i=0; i<256; i++)
printf("%3i: %2i %2i %2i\n",i,gr_palette[3*i],gr_palette[3*i+1],gr_palette[3*i+2]);
con_printf(CON_DEBUG,"%3i: %2i %2i %2i\n",i,gr_palette[3*i],gr_palette[3*i+1],gr_palette[3*i+2]);
for (i=0; i<16; i++) {
printf("\nFade table #%i\n",i);
con_printf(CON_DEBUG,"\nFade table #%i\n",i);
for (j=0; j<256; j++) {
int c = gr_fade_table[i*256 + j];
printf("[%3i %2i %2i %2i] ",c, gr_palette[3*c], gr_palette[3*c+1], gr_palette[3*c+2]);
con_printf(CON_DEBUG,"[%3i %2i %2i %2i] ",c, gr_palette[3*c], gr_palette[3*c+1], gr_palette[3*c+2]);
if ((j % 8) == 7)
printf("\n");
con_printf(CON_DEBUG,"\n");
}
}
printf("Colors indexed by intensity:\n");
printf(". = change from previous, * = no change\n");
con_printf(CON_DEBUG,"Colors indexed by intensity:\n");
con_printf(CON_DEBUG,". = change from previous, * = no change\n");
for (j=0; j<256; j++) {
printf("%3i: ",j);
con_printf(CON_DEBUG,"%3i: ",j);
prev_color = -1;
for (i=0; i<16; i++) {
int c = gr_fade_table[i*256 + j];
if (c == prev_color)
printf("*");
con_printf(CON_DEBUG,"*");
else
printf(".");
con_printf(CON_DEBUG,".");
prev_color = c;
}
printf(" ");
con_printf(CON_DEBUG," ");
for (i=0; i<16; i++) {
int c = gr_fade_table[i*256 + j];
printf("[%3i %2i %2i %2i] ", c, gr_palette[3*c], gr_palette[3*c+1], gr_palette[3*c+2]);
con_printf(CON_DEBUG,"[%3i %2i %2i %2i] ", c, gr_palette[3*c], gr_palette[3*c+1], gr_palette[3*c+2]);
}
printf("\n");
con_printf(CON_DEBUG,"\n");
}
}

View File

@ -1,4 +1,3 @@
/* $Id: meddraw.c,v 1.1.1.1 2006/03/17 19:58:25 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -18,10 +17,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*
*/
#ifdef RCS
static char rcsid[] = "$Id: meddraw.c,v 1.1.1.1 2006/03/17 19:58:25 zicodxx Exp $";
#endif
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
@ -30,10 +25,6 @@ static char rcsid[] = "$Id: meddraw.c,v 1.1.1.1 2006/03/17 19:58:25 zicodxx Exp
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#ifdef __MSDOS__
#include <process.h>
#endif
#include "inferno.h"
#include "segment.h"
#include "segpoint.h"
@ -41,18 +32,14 @@ static char rcsid[] = "$Id: meddraw.c,v 1.1.1.1 2006/03/17 19:58:25 zicodxx Exp
#include "gr.h"
#include "ui.h"
#include "editor/editor.h"
#include "wall.h"
#include "switch.h"
#include "key.h"
#include "mono.h"
#include "error.h"
#include "medlisp.h"
#include "u_mem.h"
#include "render.h"
#include "game.h"
//#include "slew.h"
#include "kdefs.h"
#include "func.h"
#include "textures.h"
@ -353,7 +340,6 @@ void add_edge(int v0,int v1,ubyte type)
seg_edge *e;
//mprintf(0, "Verts = %2i %2i, type = %i ", v0, v1, type);
if (v0 > v1) swap(v0,v1);
found = find_edge(v0,v1,&e);
@ -367,7 +353,6 @@ void add_edge(int v0,int v1,ubyte type)
edge_list[used_list[n_used]].face_count++;
else if (type == ET_NOTFACING)
edge_list[used_list[n_used]].backface_count++;
//mprintf(0, "Facing count = %i, Not facing count = %i\n", edge_list[used_list[n_used]].face_count, edge_list[used_list[n_used]].backface_count);
n_used++;
} else {
if (type < e->type)
@ -376,7 +361,6 @@ void add_edge(int v0,int v1,ubyte type)
edge_list[found].face_count++;
else if (type == ET_NOTFACING)
edge_list[found].backface_count++;
//mprintf(0, "Facing count = %i, Not facing count = %i\n", edge_list[found].face_count, edge_list[found].backface_count);
}
}
@ -816,25 +800,14 @@ void draw_world(grs_canvas *screen_canvas,editor_view *v,segment *mine_ptr,int d
#if DOUBLE_BUFFER
grs_canvas temp_canvas;
// mprintf(0, "\n");
// if ( screen_canvas == LargeViewBox->canvas ) {
// CurrentBigCanvas ^= 1;
//
// gr_set_current_canvas( BigCanvas[CurrentBigCanvas] );
//
// } else {
gr_init_sub_canvas(&temp_canvas,canv_offscreen,0,0,
screen_canvas->cv_bitmap.bm_w,screen_canvas->cv_bitmap.bm_h);
gr_set_current_canvas(&temp_canvas);
// }
#else
gr_set_current_canvas(screen_canvas);
#endif
//mprintf(0, "\n");
ui_mouse_hide();
//g3_set_points(Segment_points,Vertices);

View File

@ -1,4 +1,3 @@
/* $Id: medmisc.c,v 1.1.1.1 2006/03/17 19:58:32 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -18,10 +17,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*
*/
#ifdef RCS
static char rcsid[] = "$Id: medmisc.c,v 1.1.1.1 2006/03/17 19:58:32 zicodxx Exp $";
#endif
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
@ -30,28 +25,19 @@ static char rcsid[] = "$Id: medmisc.c,v 1.1.1.1 2006/03/17 19:58:32 zicodxx Exp
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#ifdef __MSDOS__
#include <process.h>
#endif
#include "gr.h"
#include "ui.h"
#include "3d.h"
#include "u_mem.h"
#include "error.h"
#include "mono.h"
#include "key.h"
#include "func.h"
#include "inferno.h"
#include "editor/editor.h"
#include "segment.h"
#include "render.h"
#include "screens.h"
#include "object.h"
#include "texpage.h" // For texpage_goto_first
#include "meddraw.h" // For draw_World
#include "game.h"
@ -555,7 +541,6 @@ void set_view_target_from_segment(segment *sp)
if (Funky_chase_mode)
{
mprintf((0, "Trying to set chase mode\n"));
//set_chase_matrix(sp);
}
else {
@ -570,20 +555,3 @@ void set_view_target_from_segment(segment *sp)
Update_flags |= UF_VIEWPOINT_MOVED;
}

View File

@ -1,4 +1,3 @@
/* $Id: medrobot.c,v 1.1.1.1 2006/03/17 19:58:14 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -18,21 +17,12 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*
*/
#ifdef RCS
static char rcsid[] = "$Id: medrobot.c,v 1.1.1.1 2006/03/17 19:58:14 zicodxx Exp $";
#endif
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
#include <stdlib.h>
#include <stdio.h>
#ifdef __MSDOS__
#include <conio.h>
#include <direct.h>
#include <dos.h>
#endif
#include <math.h>
#include <string.h>
@ -40,11 +30,9 @@ static char rcsid[] = "$Id: medrobot.c,v 1.1.1.1 2006/03/17 19:58:14 zicodxx Exp
#include "inferno.h"
#include "segment.h"
#include "editor.h"
#include "timer.h"
#include "objpage.h"
#include "fix.h"
#include "mono.h"
#include "error.h"
#include "kdefs.h"
#include "object.h"
@ -92,7 +80,6 @@ void call_init_ai_object(object *objp, int behavior)
hide_segment = Cursegp-Segments;
}
mprintf((0, "Initializing AI object with hide segment = %i\n", hide_segment));
init_ai_object(objp-Objects, behavior, hide_segment);
if (behavior == AIB_STATION) {
@ -175,8 +162,6 @@ int RobotPrevType()
//-------------------------------------------------------------------------
int med_set_ai_path()
{
mprintf( (0, "med-set-ai-path called -- it does nothing, paths automatically set!\n" ));
return 1;
}
@ -340,7 +325,6 @@ int LocalObjectSelectNextinSegment(void)
if (Cur_object_index != -1) {
while (!is_legal_type_for_this_window(Cur_object_index)) {
//mprintf((0, "Skipping object #%i of type %i\n", Cur_object_index, Objects[Cur_object_index].type));
rval = ObjectSelectNextinSegment();
if (first_obj == Cur_object_index)
break;
@ -369,7 +353,6 @@ int LocalObjectSelectNextinMine(void)
if (Cur_object_index != -1) {
while (!is_legal_type_for_this_window(Cur_object_index)) {
//mprintf((0, "Skipping object #%i of type %i\n", Cur_object_index, Objects[Cur_object_index].type));
ObjectSelectNextInMine();
if (Cur_object_index == first_obj)
break;
@ -398,7 +381,6 @@ int LocalObjectSelectPrevinMine(void)
if (Cur_object_index != -1) {
while (!is_legal_type_for_this_window(Cur_object_index)) {
//mprintf((0, "Skipping object #%i of type %i\n", Cur_object_index, Objects[Cur_object_index].type));
ObjectSelectPrevInMine();
if (first_obj == Cur_object_index)
break;
@ -576,7 +558,6 @@ void do_robot_window()
if ( Cur_object_index > -1 ) {
int behavior = Objects[Cur_object_index].ctype.ai_info.behavior;
if ( !((behavior >= MIN_BEHAVIOR) && (behavior <= MAX_BEHAVIOR))) {
mprintf((0, "Object #%i behavior id (%i) out of bounds, setting to AIB_NORMAL.\n", Cur_object_index, behavior));
Objects[Cur_object_index].ctype.ai_info.behavior = AIB_NORMAL;
behavior = AIB_NORMAL;
}
@ -781,8 +762,6 @@ int do_object_dialog()
MattWindow->keyboard_focus_gadget = (UI_GADGET *) InitialMode[0];
mprintf((0, "X = %08x, Y = %08x, Z = %08x\n", atoi(Xmessage), atoi(Ymessage), atoi(Zmessage)));
return 1;
}

View File

@ -1,4 +1,3 @@
/* $Id: medsel.c,v 1.1.1.1 2006/03/17 19:58:49 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -18,10 +17,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*
*/
#ifdef RCS
static char rcsid[] = "$Id: medsel.c,v 1.1.1.1 2006/03/17 19:58:49 zicodxx Exp $";
#endif
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
@ -30,17 +25,11 @@ static char rcsid[] = "$Id: medsel.c,v 1.1.1.1 2006/03/17 19:58:49 zicodxx Exp $
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#ifdef __MSDOS__
#include <process.h>
#endif
#include "gr.h"
#include "ui.h"
#include "key.h"
#include "mono.h"
#include "error.h"
#include "u_mem.h"
#include "inferno.h"
#include "editor.h"
#include "segment.h"

View File

@ -1,4 +1,3 @@
/* $Id: medwall.c,v 1.1.1.1 2006/03/17 19:58:48 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -18,10 +17,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*
*/
#ifdef RCS
static char rcsid[] = "$Id: medwall.c,v 1.1.1.1 2006/03/17 19:58:48 zicodxx Exp $";
#endif
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
@ -30,23 +25,19 @@ static char rcsid[] = "$Id: medwall.c,v 1.1.1.1 2006/03/17 19:58:48 zicodxx Exp
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include "editor/medwall.h"
#include "inferno.h"
#include "editor/editor.h"
#include "segment.h"
#include "error.h"
#include "gameseg.h"
#include "textures.h"
#include "screens.h"
#include "switch.h"
#include "editor/eswitch.h"
#include "texmerge.h"
#include "medrobot.h"
#include "timer.h"
#include "mono.h"
#include "cntrlcen.h"
#include "key.h"
#include "ehostage.h"
@ -216,12 +207,10 @@ int GotoPrevWall() {
if (current_wall >= Num_walls) current_wall = Num_walls-1;
if (Walls[current_wall].segnum == -1) {
mprintf((0, "Trying to goto wall at bogus segnum\n"));
return 0;
}
if (Walls[current_wall].sidenum == -1) {
mprintf((0, "Trying to goto wall at bogus sidenum\n"));
return 0;
}
@ -243,12 +232,10 @@ int GotoNextWall() {
if (current_wall < 0) current_wall = 0;
if (Walls[current_wall].segnum == -1) {
mprintf((0, "Trying to goto wall at bogus segnum\n"));
return 0;
}
if (Walls[current_wall].sidenum == -1) {
mprintf((0, "Trying to goto wall at bogus sidenum\n"));
return 0;
}
@ -475,7 +462,6 @@ void do_wall_window()
for ( i=0; i < 4; i++ ) {
if ( KeyFlag[i]->flag == 1 ) {
Walls[Cursegp->sides[Curside].wall_num].keys = 1<<i; // Set the ai_state to the cooresponding radio button
// mprintf((0, "1<<%d = %d\n", i, 1<<i));
}
}
} else {
@ -639,7 +625,6 @@ int wall_delete_bogus(short wall_num)
int seg, side;
if ((Walls[wall_num].segnum != -1) && (Walls[wall_num].sidenum != -1)) {
mprintf((0,"WALL IS NOT BOGUS.\n"));
return 0;
}
@ -656,8 +641,6 @@ int wall_delete_bogus(short wall_num)
if (Segments[seg].sides[side].wall_num > wall_num)
Segments[seg].sides[side].wall_num--;
mprintf((0,"BOGUS WALL DELETED!!!!\n"));
return 1;
}
@ -941,9 +924,6 @@ int bind_wall_to_control_center() {
ControlCenterTriggers.side[link_num] = Curside;
ControlCenterTriggers.num_links++;
mprintf((0, "seg %d:side %d linked to control center link_num %d\n",
ControlCenterTriggers.seg[link_num], ControlCenterTriggers.side[link_num], link_num));
editor_status("Wall linked to control center");
return 1;
@ -1011,7 +991,7 @@ int wall_unlink_door()
int check_walls()
{
int w, seg, side, wall_count, trigger_count;
int w1, w2, t, l;
int w1;
count_wall CountedWalls[MAX_WALLS];
char Message[DIAGNOSTIC_MESSAGE_MAX];
int matcen_num;
@ -1023,14 +1003,11 @@ int check_walls()
matcen_num = Segment2s[seg].matcen_num;
if (matcen_num == 0)
if (RobotCenters[0].segnum != seg) {
mprintf((0,"Fixing Matcen 0\n"));
Segment2s[seg].matcen_num = -1;
}
if (matcen_num > -1)
if (RobotCenters[matcen_num].segnum != seg) {
mprintf((0,"Matcen [%d] (seg %d) doesn't point back to correct segment %d\n", matcen_num, RobotCenters[matcen_num].segnum, seg));
mprintf((0,"Fixing....\n"));
RobotCenters[matcen_num].segnum = seg;
}
@ -1039,22 +1016,10 @@ int check_walls()
CountedWalls[wall_count].wallnum = Segments[seg].sides[side].wall_num;
CountedWalls[wall_count].segnum = seg;
CountedWalls[wall_count].sidenum = side;
// Check if segnum is bogus
if (Walls[Segments[seg].sides[side].wall_num].segnum == -1) {
mprintf((0, "Wall %d at seg:side %d:%d is BOGUS\n", Segments[seg].sides[side].wall_num, seg, side));
}
if (Walls[Segments[seg].sides[side].wall_num].type == WALL_NORMAL) {
mprintf((0, "Wall %d at seg:side %d:%d is NORMAL (BAD)\n", Segments[seg].sides[side].wall_num, seg, side));
}
wall_count++;
}
}
mprintf((0,"Wall Count = %d\n", wall_count));
if (wall_count != Num_walls) {
sprintf( Message, "Num_walls is bogus\nDo you wish to correct it?\n");
if (MessageBox( -2, -2, 2, Message, "Yes", "No" )==1) {
@ -1067,35 +1032,16 @@ int check_walls()
for (w=0; w<Num_walls; w++) {
if ((Walls[CountedWalls[w].wallnum].segnum != CountedWalls[w].segnum) ||
(Walls[CountedWalls[w].wallnum].sidenum != CountedWalls[w].sidenum)) {
mprintf((0,"Unmatched walls on wall_num %d\n", CountedWalls[w].wallnum));
sprintf( Message, "Unmatched wall detected\nDo you wish to correct it?\n");
if (MessageBox( -2, -2, 2, Message, "Yes", "No" )==1) {
Walls[CountedWalls[w].wallnum].segnum = CountedWalls[w].segnum;
Walls[CountedWalls[w].wallnum].sidenum = CountedWalls[w].sidenum;
}
}
if (CountedWalls[w].wallnum >= Num_walls)
mprintf((0,"wallnum %d in Segments exceeds Num_walls!\n", CountedWalls[w].wallnum));
if (Walls[w].segnum == -1) {
mprintf((0, "Wall[%d] is BOGUS\n", w));
for (seg=0;seg<=Highest_segment_index;seg++)
for (side=0;side<MAX_SIDES_PER_SEGMENT;side++)
if (Segments[seg].sides[side].wall_num == w) {
mprintf((0, " BOGUS WALL found at seg:side %d:%d\n", seg, side));
}
}
}
trigger_count = 0;
for (w1=0; w1<wall_count; w1++) {
for (w2=w1+1; w2<wall_count; w2++)
if (CountedWalls[w1].wallnum == CountedWalls[w2].wallnum) {
mprintf((0, "Duplicate Walls %d and %d. Wallnum=%d. ", w1, w2, CountedWalls[w1].wallnum));
mprintf((0, "Seg1:sides1 %d:%d ", CountedWalls[w1].segnum, CountedWalls[w1].sidenum));
mprintf((0, "Seg2:sides2 %d:%d\n", CountedWalls[w2].segnum, CountedWalls[w2].sidenum));
}
if (Walls[w1].trigger != -1) trigger_count++;
}
@ -1107,39 +1053,6 @@ int check_walls()
}
}
mprintf((0,"Trigger Count = %d\n", trigger_count));
for (t=0; t<trigger_count; t++) {
if (Triggers[t].flags & TRIGGER_MATCEN)
{
if (Triggers[t].num_links < 1)
mprintf((0,"No valid links on Matcen Trigger %d\n", t));
else
for (l=0;l<Triggers[t].num_links;l++) {
if (!Segment2s[Triggers[t].seg[l]].special & SEGMENT_IS_ROBOTMAKER)
mprintf((0,"Bogus Matcen trigger detected on Trigger %d, No matcen at seg %d\n", t, Triggers[t].seg[l]));
}
}
if (Triggers[t].flags & TRIGGER_EXIT)
if (Triggers[t].num_links != 0)
mprintf((0,"Bogus links detected on Exit Trigger %d\n", t));
if (Triggers[t].flags & TRIGGER_CONTROL_DOORS)
for (l=0;l<Triggers[t].num_links;l++) {
if (Segments[Triggers[t].seg[l]].sides[Triggers[t].side[l]].wall_num == -1) {
mprintf((0,"Bogus Link detected on Door Control Trigger %d, link %d\n", t, l));
mprintf((0,"Bogus Link at seg %d, side %d\n", Triggers[t].seg[l], Triggers[t].side[l]));
}
}
}
for (l=0;l<ControlCenterTriggers.num_links;l++)
if (Segments[ControlCenterTriggers.seg[l]].sides[ControlCenterTriggers.side[l]].wall_num == -1) {
mprintf((0,"Bogus Link detected on Control Center Trigger, link %d\n", l));
mprintf((0,"Bogus Link at seg %d, side %d\n", Triggers[t].seg[l], Triggers[t].side[l]));
}
return 1;
}
@ -1307,7 +1220,6 @@ void copy_group_walls(int old_group, int new_group)
for (j=0; j<MAX_SIDES_PER_SEGMENT; j++) {
if (Segments[old_seg].sides[j].wall_num != -1) {
mprintf((0, "Going to add wall to seg:side = %i:%i\n", new_seg, j));
Segments[new_seg].sides[j].wall_num = Num_walls;
copy_old_wall_data_to_new(Segments[old_seg].sides[j].wall_num, Num_walls);
Walls[Num_walls].segnum = new_seg;

View File

@ -1,4 +1,3 @@
/* $Id: mine.c,v 1.1.1.1 2006/03/17 19:58:35 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -18,10 +17,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*
*/
#ifdef RCS
static char rcsid[] = "$Id: mine.c,v 1.1.1.1 2006/03/17 19:58:35 zicodxx Exp $";
#endif
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
@ -30,32 +25,24 @@ static char rcsid[] = "$Id: mine.c,v 1.1.1.1 2006/03/17 19:58:35 zicodxx Exp $";
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include "physfsx.h"
#include "nocfile.h"
#include "mono.h"
#include "key.h"
#include "gr.h"
#include "bm.h" // for MAX_TEXTURES
#include "inferno.h"
#include "segment.h"
#include "editor.h"
#include "error.h"
#include "textures.h"
#include "object.h"
#include "gamemine.h"
#include "gamesave.h"
#include "gameseg.h"
#include "ui.h" // Because texpage.h need UI_WINDOW type
#include "texpage.h" // For texpage_goto_first
#include "medwall.h"
#include "switch.h"
#include "fuelcen.h"
#define REMOVE_EXT(s) (*(strchr( (s), '.' ))='\0')
@ -502,11 +489,9 @@ void dump_fix_as_short( fix value, int nbits, PHYSFS_file *SaveFile )
int_value = (int)(value>>nbits);
if( int_value > 0x7fff ) {
short_value = 0x7fff;
mprintf((1, "Warning: Fix (%8x) won't fit in short. Saturating to %8x.\n", int_value, short_value<<nbits));
}
else if( int_value < -0x7fff ) {
short_value = -0x7fff;
mprintf((1, "Warning: Fix (%8x) won't fit in short. Saturating to %8x.\n", int_value, short_value<<nbits));
}
else
short_value = (short)int_value;
@ -521,7 +506,6 @@ void dump_fix_as_ushort( fix value, int nbits, PHYSFS_file *SaveFile )
ushort short_value;
if (value < 0) {
mprintf((1, "Warning: fix (%8x) is signed...setting to zero.\n", value));
Int3(); //hey---show this to Matt
value = 0;
}
@ -530,7 +514,6 @@ void dump_fix_as_ushort( fix value, int nbits, PHYSFS_file *SaveFile )
if( int_value > 0xffff ) {
short_value = 0xffff;
mprintf((1, "Warning: Fix (%8x) won't fit in unsigned short. Saturating to %8x.\n", int_value, short_value<<nbits));
}
else
short_value = int_value;

View File

@ -1,4 +1,3 @@
/* $Id: objpage.c,v 1.1.1.1 2006/03/17 19:58:49 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -18,31 +17,19 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*
*/
#ifdef RCS
static char rcsid[] = "$Id: objpage.c,v 1.1.1.1 2006/03/17 19:58:49 zicodxx Exp $";
#endif
// Num_robot_types --> N_polygon_models
// Cur_robot_type --> Cur_robot_type
// Texture[Cur_robot_type]->bitmap ---> robot_bms[robot_bm_nums[ Cur_robot_type ] ]
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
#include <stdlib.h>
#include <stdio.h>
#include "inferno.h"
#include "screens.h" // For GAME_SCREEN?????
#include "editor.h" // For TMAP_CURBOX??????
#include "gr.h" // For canves, font stuff
#include "ui.h" // For UI_GADGET stuff
#include "object.h" // For robot_bms
#include "mono.h" // For debugging
#include "error.h"
#include "objpage.h"
#include "bm.h"
#include "player.h"
@ -56,32 +43,6 @@ static UI_GADGET_USERBOX * ObjCurrent;
static int ObjectPage = 0;
//static char Description[8][20] = { "Pig", "Star", "Little\nJosh", "Big\nJosh", "Flying\nPig", "Flying\nStar",
//"Little\nFlying\nJosh", "Big\nFlying\nJosh" };
//static grs_canvas * ObjnameCanvas;
//static char object_filename[13];
//static void objpage_print_name( char name[13] ) {
// short w,h,aw;
//
// gr_set_current_canvas( ObjnameCanvas );
// gr_get_string_size( name, &w, &h, &aw );
// gr_string( 0, 0, name );
// //gr_set_fontcolor( CBLACK, CWHITE );
//}
//static void objpage_display_name( char *format, ... ) {
// va_list ap;
//
// va_start(ap, format);
// vsprintf(object_filename, format, ap);
// va_end(ap);
//
// objpage_print_name(object_filename);
//
//}
#include "vecmat.h"
#include "3d.h"
#include "polyobj.h"

View File

@ -1,4 +1,3 @@
/* $Id: segment.c,v 1.1.1.1 2006/03/17 19:58:29 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -26,22 +25,16 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include "mono.h"
#include "key.h"
#include "gr.h"
#include "inferno.h"
#include "segment.h"
// #include "segment2.h"
#include "editor.h"
#include "error.h"
#include "object.h"
#include "gameseg.h"
#include "render.h"
#include "game.h"
#include "wall.h"
#include "switch.h"
#include "fuelcen.h"
@ -379,7 +372,6 @@ int med_add_vertex(vms_vector *vp)
if (Vertex_active[v]) {
count++;
if (vnear(vp,&Vertices[v])) {
// mprintf((0,"[%4i] ",v));
return v;
}
} else if (free_index == -1)
@ -480,7 +472,6 @@ int med_set_vertex(int vnum,vms_vector *vp)
Vertex_active[vnum] = 1;
Num_vertices++;
if ((vnum > Highest_vertex_index) && (vnum < NEW_SEGMENT_VERTICES)) {
mprintf((0,"Warning -- setting a previously unset vertex, index = %i.\n",vnum));
Highest_vertex_index = vnum;
}
}
@ -566,7 +557,6 @@ int check_for_degenerate_segment(segment *sp)
if (dot > 0)
degeneracy_flag = 0;
else {
mprintf((0, "segment #%i is degenerate due to cross product check.\n", sp-Segments));
degeneracy_flag = 1;
}
@ -665,7 +655,6 @@ void med_extract_matrix_from_segment(segment *sp,vms_matrix *rotmat)
extract_up_vector_from_segment(sp,&upvec);
if (((forwardvec.x == 0) && (forwardvec.y == 0) && (forwardvec.z == 0)) || ((upvec.x == 0) && (upvec.y == 0) && (upvec.z == 0))) {
mprintf((0, "Trapped null vector in med_extract_matrix_from_segment, returning identity matrix.\n"));
*rotmat = vmd_identity_matrix;
return;
}
@ -1197,7 +1186,6 @@ int med_delete_segment(segment *sp)
// Don't try to delete if segment doesn't exist.
if (sp->segnum == -1) {
mprintf((0,"Hey -- you tried to delete a non-existent segment (segnum == -1)\n"));
return 1;
}
@ -1257,10 +1245,6 @@ int med_delete_segment(segment *sp)
// If deleted segment contains objects, wipe out all objects
if (sp->objects != -1) {
// if (objnum == Objects[objnum].next) {
// mprintf((0, "Warning -- object #%i points to itself. Setting next to -1.\n", objnum));
// Objects[objnum].next = -1;
// }
for (objnum=sp->objects;objnum!=-1;objnum=Objects[objnum].next) {
//if an object is in the seg, delete it
@ -1337,9 +1321,6 @@ int med_rotate_segment(segment *seg, vms_matrix *rotmat)
// Before deleting the segment, copy its texture maps to New_segment
copy_tmaps_to_segment(&New_segment,seg);
if (med_delete_segment(seg))
mprintf((0,"Error in rotation: Unable to delete segment %i\n",seg-Segments));
if (Curside == WFRONT)
Curside = WBACK;
@ -1538,27 +1519,6 @@ int med_form_joint(segment *seg1, int side1, segment *seg2, int side2)
set_vertex_counts();
// Make sure connection is open, ie renderable.
// seg1->sides[side1].render_flag = 0;
// seg2->sides[side2].render_flag = 0;
//--// debug -- check all segments, make sure if a children[s] == -1, then side[s].num_faces != 0
//--{
//--int seg,side;
//--for (seg=0; seg<MAX_SEGMENTS; seg++)
//-- if (Segments[seg].segnum != -1)
//-- for (side=0; side<MAX_SIDES_PER_SEGMENT; side++)
//-- if (Segments[seg].children[side] == -1) {
//-- if (Segments[seg].sides[side].num_faces == 0) {
//-- mprintf((0,"Error: Segment %i, side %i is not connected, but has 0 faces.\n",seg,side));
//-- Int3();
//-- }
//-- } else if (Segments[seg].sides[side].num_faces != 0) {
//-- mprintf((0,"Error: Segment %i, side %i is connected, but has %i faces.\n",seg,side,Segments[seg].sides[side].num_faces));
//-- Int3();
//-- }
//--}
return 0;
}
@ -1580,7 +1540,6 @@ int med_form_bridge_segment(segment *seg1, int side1, segment *seg2, int side2)
return 1;
bs = &Segments[get_free_segment_number()];
// mprintf((0,"Forming bridge segment %i from %i to %i\n",bs-Segments,seg1-Segments,seg2-Segments));
bs->segnum = bs-Segments;
bs->objects = -1;
@ -1622,7 +1581,6 @@ int med_form_bridge_segment(segment *seg1, int side1, segment *seg2, int side2)
bs->children[AttachSide] = -1;
bs->children[(int) Side_opposite[AttachSide]] = -1;
if (med_delete_segment(bs)) {
mprintf((0, "Oops, tried to delete bridge segment (because it's degenerate), but couldn't.\n"));
Int3();
}
editor_status("Bridge segment would be degenerate, not created.\n");
@ -2106,7 +2064,6 @@ void check_for_overlapping_segment(int segnum)
if (i != segnum) {
masks = get_seg_masks(&segcenter, i, 0, __FILE__, __LINE__);
if (masks.centermask == 0) {
mprintf((0, "Segment %i center is contained in segment %i\n", segnum, i));
continue;
}
@ -2117,7 +2074,6 @@ void check_for_overlapping_segment(int segnum)
vm_vec_scale_add(&presult, &segcenter, &pdel, (F1_0*15)/16);
masks = get_seg_masks(&presult, i, 0, __FILE__, __LINE__);
if (masks.centermask == 0) {
mprintf((0, "Segment %i near vertex %i is contained in segment %i\n", segnum, v, i));
break;
}
}
@ -2135,10 +2091,6 @@ void check_for_overlapping_segments(void)
med_compress_mine();
for (i=0; i<=Highest_segment_index; i++) {
mprintf((0, "+"));
check_for_overlapping_segment(i);
}
mprintf((0, "\nDone!\n"));
}

View File

@ -1,4 +1,3 @@
/* $Id: seguvs.c,v 1.1.1.1 2006/03/17 19:58:39 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -18,10 +17,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*
*/
#ifdef RCS
static char rcsid[] = "$Id: seguvs.c,v 1.1.1.1 2006/03/17 19:58:39 zicodxx Exp $";
#endif
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
@ -31,17 +26,12 @@ static char rcsid[] = "$Id: seguvs.c,v 1.1.1.1 2006/03/17 19:58:39 zicodxx Exp $
#include <stdarg.h>
#include <math.h>
#include <string.h>
#include "inferno.h"
#include "segment.h"
#include "editor/editor.h"
#include "gameseg.h"
#include "fix.h"
#include "mono.h"
#include "error.h"
#include "wall.h"
#include "editor/kdefs.h"
#include "bm.h" // Needed for TmapInfo
@ -214,7 +204,6 @@ void set_average_light_on_side(segment *segp, int sidenum)
if (!IS_CHILD(segp->children[sidenum]))
for (v=0; v<4; v++) {
// mprintf((0,"Vertex %i\n", segp->verts[Side_to_verts[side][v]]));
set_average_light_at_vertex(segp->verts[Side_to_verts[sidenum][v]]);
}
@ -313,7 +302,7 @@ void set_average_light_on_all_fast(void)
}
extern int Doing_lighting_hack_flag; // If set, don't mprintf warning messages in gameseg.c/find_point_seg
extern int Doing_lighting_hack_flag;
int set_average_light_on_all(void)
{
// set_average_light_on_all_fast();
@ -434,7 +423,7 @@ void check_lighting_side(segment *sp, int sidenum)
for (v=0; v<4; v++)
if ((sidep->uvls[v].l > F1_0*16) || (sidep->uvls[v].l < 0))
Int3(); //mprintf(0,"Bogus lighting value in segment %i, side %i, vert %i = %x\n",sp-Segments, side, v, sidep->uvls[v].l);
Int3();
}
void check_lighting_segment(segment *segp)
@ -576,7 +565,6 @@ void assign_uvs_to_side(segment *segp, int sidenum, uvl *uva, uvl *uvb, int va,
// Assign u,v scale to a unit length right vector.
fmag = zhypot(uvhi.v - uvlo.v,uvhi.u - uvlo.u);
if (fmag < 64) { // this is a fix, so 64 = 1/1024
mprintf((0,"Warning: fmag = %7.3f, using approximate u,v values\n",f2fl(fmag)));
ruvmag.u = F1_0*256;
ruvmag.v = F1_0*256;
fuvmag.u = F1_0*256;
@ -601,7 +589,6 @@ void assign_uvs_to_side(segment *segp, int sidenum, uvl *uva, uvl *uvb, int va,
vm_vec_sub(&rvec,&Vertices[v3],&Vertices[v0]);
if (((fvec.x == 0) && (fvec.y == 0) && (fvec.z == 0)) || ((rvec.x == 0) && (rvec.y == 0) && (rvec.z == 0))) {
mprintf((1, "Trapped null vector in assign_uvs_to_side, using identity matrix.\n"));
rotmat = vmd_identity_matrix;
} else
vm_vector_2_matrix(&rotmat,&fvec,0,&rvec);
@ -609,7 +596,6 @@ void assign_uvs_to_side(segment *segp, int sidenum, uvl *uva, uvl *uvb, int va,
rvec = rotmat.rvec; vm_vec_negate(&rvec);
fvec = rotmat.fvec;
// mprintf((0, "va = %i, vb = %i\n", va, vb));
mag01 = vm_vec_dist(&Vertices[v1],&Vertices[v0]);
if ((va == 0) || (va == 2))
mag01 = fixmul(mag01, Stretch_scale_x);
@ -886,8 +872,6 @@ void get_side_ids(segment *base_seg, segment *con_seg, int base_side, int con_si
}
}
// mprintf((0,"side %3i adjacent to side %3i\n",*base_common_side,*con_common_side));
Assert((*base_common_side != -1) && (*con_common_side != -1));
}
@ -1008,7 +992,6 @@ void fix_bogus_uvs_on_side1(segment *sp, int sidenum, int uvonly_flag)
side *sidep = &sp->sides[sidenum];
if ((sidep->uvls[0].u == 0) && (sidep->uvls[1].u == 0) && (sidep->uvls[2].u == 0)) {
mprintf((0,"Found bogus segment %i, side %i\n", sp-Segments, sidenum));
med_propagate_tmaps_to_back_side(sp, sidenum, uvonly_flag);
}
}
@ -1092,7 +1075,6 @@ void med_propagate_tmaps_to_segments(segment *base_seg,segment *con_seg, int uv_
{
int s;
// mprintf((0,"Propagating segments from %i to %i\n",base_seg-Segments,con_seg-Segments));
for (s=0; s<MAX_SIDES_PER_SEGMENT; s++)
if (base_seg->children[s] == con_seg-Segments)
propagate_tmaps_to_segment_sides(base_seg, s, con_seg, find_connect_side(base_seg, con_seg), uv_only_flag);
@ -1164,8 +1146,6 @@ void cast_light_from_side(segment *segp, int light_side, fix light_intensity, in
compute_segment_center(&segment_center, segp);
//mprintf((0, "From [%i %i %7.3f]: ", segp-Segments, light_side, f2fl(light_intensity)));
// Do for four lights, one just inside each corner of side containing light.
for (lightnum=0; lightnum<4; lightnum++) {
int light_vertex_num, i;
@ -1206,7 +1186,6 @@ void cast_light_from_side(segment *segp, int light_side, fix light_intensity, in
side *rsidep = &rsegp->sides[sidenum];
vms_vector *side_normalp = &rsidep->normals[0]; // kinda stupid? always use vector 0.
//mprintf((0, "[%i %i], ", rsegp-Segments, sidenum));
for (vertnum=0; vertnum<4; vertnum++) {
fix distance_to_point, light_at_point, light_dot;
vms_vector vert_location, vector_to_light;
@ -1249,7 +1228,6 @@ void cast_light_from_side(segment *segp, int light_side, fix light_intensity, in
while (1) {
if (hashp->flag) {
if ((hashp->vector.x == vector_to_light.x) && (hashp->vector.y == vector_to_light.y) && (hashp->vector.z == vector_to_light.z)) {
//mprintf((0, "{CACHE %4x} ", hash_value));
hit_type = hashp->hit_type;
Hash_hits++;
break;
@ -1260,7 +1238,6 @@ void cast_light_from_side(segment *segp, int light_side, fix light_intensity, in
hashp = &fvi_cache[hash_value];
}
} else {
//mprintf((0, "\nH:%04x ", hash_value));
fvi_query fq;
Hash_calcs++;
@ -1282,12 +1259,10 @@ void cast_light_from_side(segment *segp, int light_side, fix light_intensity, in
}
} else
hit_type = HIT_NONE;
//mprintf((0, "hit=%i ", hit_type));
switch (hit_type) {
case HIT_NONE:
light_at_point = fixmul(light_at_point, light_intensity);
rsidep->uvls[vertnum].l += light_at_point;
//mprintf((0, "(%5.2f) ", f2fl(light_at_point)));
if (rsidep->uvls[vertnum].l > F1_0)
rsidep->uvls[vertnum].l = F1_0;
break;
@ -1310,8 +1285,6 @@ void cast_light_from_side(segment *segp, int light_side, fix light_intensity, in
} // end for (segnum=0...
} // end for (lightnum=0...
//mprintf((0, "\n"));
}
@ -1425,7 +1398,6 @@ void calim_process_all_lights(int quick_light)
for (segnum=0; segnum<=Highest_segment_index; segnum++) {
segment *segp = &Segments[segnum];
mprintf((0, "."));
for (sidenum=0; sidenum<MAX_SIDES_PER_SEGMENT; sidenum++) {
// if (!IS_CHILD(segp->children[sidenum])) {
if (WALL_IS_DOORWAY(segp, sidenum) != WID_NO_WALL) {

View File

@ -27,10 +27,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include <stdio.h>
#include <stdarg.h>
#ifdef RCS
static char rcsid[] = "$Id: texpage.c,v 1.1.1.1 2006/03/17 19:58:35 zicodxx Exp $";
#endif
#include "inferno.h"
#include "gameseg.h"
#include "screens.h" // For GAME_SCREEN?????
@ -40,7 +36,6 @@ static char rcsid[] = "$Id: texpage.c,v 1.1.1.1 2006/03/17 19:58:35 zicodxx Exp
#include "textures.h" // For NumTextures
#include "error.h"
#include "key.h"
#include "mono.h"
#include "gamesave.h"
#include "mission.h"
@ -246,12 +241,10 @@ void texpage_do()
texpage_show_current();
if (keyd_pressed[KEY_LSHIFT]) {
mprintf((0, "Will replace CurrentTexture (%i) with...(select by pressing Ctrl)\n", CurrentTexture));
Replacement_list[Num_replacements].old = CurrentTexture;
}
if (keyd_pressed[KEY_LCTRL]) {
mprintf((0, "...Replacement texture for %i is %i\n", Replacement_list[Num_replacements].old, CurrentTexture));
Replacement_list[Num_replacements].new = CurrentTexture;
Num_replacements++;
}
@ -284,7 +277,6 @@ void do_replacements(void)
side *sidep=&segp->sides[sidenum];
if (sidep->tmap_num == old_tmap_num) {
sidep->tmap_num = new_tmap_num;
// mprintf((0, "Replacing tmap_num on segment:side = %i:%i\n", segnum, sidenum));
}
if ((sidep->tmap_num2 != 0) && ((sidep->tmap_num2 & 0x3fff) == old_tmap_num)) {
if (new_tmap_num == 0) {
@ -292,7 +284,6 @@ void do_replacements(void)
// the 0th tmap_num2 which is ILLEGAL!
} else {
sidep->tmap_num2 = new_tmap_num | (sidep->tmap_num2 & 0xc000);
// mprintf((0, "Replacing tmap_num2 on segment:side = %i:%i\n", segnum, sidenum));
}
}
}

View File

@ -1,4 +1,3 @@
/* $Id: texpage.h,v 1.1.1.1 2006/03/17 19:58:35 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO

View File

@ -1,4 +1,3 @@
/* $Id: texture.c,v 1.1.1.1 2006/03/17 19:58:41 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -18,10 +17,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*
*/
#ifdef RCS
static char rcsid[] = "$Id: texture.c,v 1.1.1.1 2006/03/17 19:58:41 zicodxx Exp $";
#endif
#ifdef HAVE_CONFIG_H
#include "conf.h"
#endif
@ -31,14 +26,11 @@ static char rcsid[] = "$Id: texture.c,v 1.1.1.1 2006/03/17 19:58:41 zicodxx Exp
#include <stdarg.h>
#include <math.h>
#include <string.h>
#include "inferno.h"
#include "segment.h"
#include "seguvs.h"
#include "editor.h"
#include "fix.h"
#include "mono.h"
#include "error.h"
#include "kdefs.h"

View File

@ -1,4 +1,3 @@
/* $Id: effects.c,v 1.1.1.1 2006/03/17 19:57:04 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -23,10 +22,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include <conf.h>
#endif
#ifdef RCS
static char rcsid[] = "$Id: effects.c,v 1.1.1.1 2006/03/17 19:57:04 zicodxx Exp $";
#endif
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
@ -38,7 +33,6 @@ static char rcsid[] = "$Id: effects.c,v 1.1.1.1 2006/03/17 19:57:04 zicodxx Exp
#include "vclip.h"
#include "effects.h"
#include "bm.h"
#include "mono.h"
#include "u_mem.h"
#include "textures.h"
#include "cntrlcen.h"
@ -177,7 +171,6 @@ void restart_effect(int effect_num)
//Assert(Effects[effect_num].bm_ptr != -1);
}
#ifndef FAST_FILE_IO
/*
* reads n eclip structs from a CFILE
*/
@ -203,4 +196,3 @@ int eclip_read_n(eclip *ec, int n, CFILE *fp)
}
return i;
}
#endif

View File

@ -69,13 +69,9 @@ void stop_effect(int effect_num);
//restart a stopped effect
void restart_effect(int effect_num);
#ifdef FAST_FILE_IO
#define eclip_read_n(ec, n, fp) cfread(ec, sizeof(eclip), n, fp)
#else
/*
* reads n eclip structs from a CFILE
*/
extern int eclip_read_n(eclip *ec, int n, CFILE *fp);
#endif
#endif /* _EFFECTS_H */

Some files were not shown because too many files have changed in this diff Show More